Relative Content

Tag Archive for pythonpython-3.xpython-import

Inconsistent Python import behaviour with subdirectories

When splitting my python code into simple modules and putting them in a subdirectory, I see seemingly inconsistent behaviour that I was not able to solve by adding an __init__.py file in the module. I am also unable to understand why things not seem to work consistently. Please explain or point to documentation where this “logic” is explained:

Import files from external submodule

Is it possible to execute an external submodule of a project without changing the file content of the submodule itself?
Suppose I have this hierarchy.