Use __init__.py to make a directory a Python package and control what happens when that package is imported. Python executes the file, where it can import modules such as first.py and expose their contents through the package. section 9.9
Choose an import form based on the name you want available:
- from mypackage import first makes first available directly. section 9.9
- import mypackage.first keeps the fully qualified module name. section 9.9
- import mypackage loads and executes mypackage/__init__.py. section 9.9
Package layout
Place first.py, second.py, and third.py in mypackage, add __init__.py, and ensure the directory is on sys.path. Importing mypackage can then initialize the package and import selected internal modules. section 9.9
import mypackage
Inspect the minimal package import form that triggers __init__.py. section 9.9



