package
├── \__init\__.py
├── module.py
├── nested_package
│ ├── \__init\__.py
│ ├── other_module.py
│ └── satellizer.min.js
This repo could be cloned directly to investigate filesystem structure.
For each dir and file purpose, check this paragraph
A file modu.py in the directory pack/
is imported with the statement import pack.modu
.
This statement will look for an __init__.py
file in pack
, execute all of its top-level statements.
Then it will look for a file named pack/modu.py
and execute all of its top-level statements.
After these operations, any variable, function, or class defined in modu.py
is available in the pack.modu
namespace.
This paragraph is extracted from, and more considerations could be found at, this paragraph
- A module is a file ending with .py and a package is a folder containing modules and (nested) packages again
- Python recognizes a folder as a package if it contains a _init_.py file
- Keep modules and package names lowercase (just more pythonic)