meta data for this page
modules
Python defines two types of packages, regular packages and namespace packages. Regular packages are traditional packages as they existed in Python 3.2 and earlier. A regular package is typically implemented as a directory containing an init.py file. When a regular package is imported, this init.py file is implicitly executed, and the objects it defines are bound to names in the package’s namespace.
__init__.py
It is required to make Python tread directories as packages. It can be simply empty file. This file is always executed when any part of module is imported.
__main__.py
Most commonly, the main.py
file is used to provide a command-line interface for a package.
main.py
will be executed when the package itself is invoked directly from the command line using the -m flag.
https://docs.python.org/3/library/__main__.html#main-py-in-python-packages