./mypackage
__init__.py
mymodule.py
./myfolder
__init__.py
somemodule.py
./somepackage
others.py
# Here 'mypackage' folder contains '__init__.py' so it's s a package,
# Similarly 'myfolder' is also a package (or sub-package).
# Note: From Python 3.3 and up it is optional to have '__init__.py'
# to be called package, so now 'somepackage' directory is also a package.
## Importing a module from package
import mypackage.mymodule
# now use the '<module_name>' to call its classes/functions
mymodule.myfunction()
## Importing the package by name
import mypackage
# this will call './mypackage/__init__.py' module
## But to import specific classes/functions from that module you
# need to use 'from...import', say import a class from 'mymodule'
from mypackage.mymodule import MyClass
# similarly a function
from mypackage.mymodule import myfunction