I have read the documentation and there is something I\'m still not sure about. Does all the initialisation code for the whole module in __init__.py
get run if I do
The code in __init__.py
is run whenever you import anything from the package. That includes importing other modules in that package.
The style of import (import packagename
or from packagename import some_name
) doesn't matter here.
Like all modules, the code is run just once, and entered into sys.modules
under the package name.