Recently, I’ve committed Python project repositories. Then, I faced an issue which happened by import syntax.
Below article helped me to understand the import further in Python 2 and 3.
https://chrisyeh96.github.io/2017/08/08/definitive-guide-python-imports.html
When a module is imported, Python runs all of the code in the module file. When a package is imported, Python runs all of the code in the package’s init__.py file, if such a file exists. All of the objects defined in the module or the package’s __init.py file are made available to the importer.
and
– An
__init__.pyfile has 2 functions.
convert a folder of scripts into an importable package of modules (before Python 3.3)
– run package initialization code
I thought the __init__.py was just an initialization. But the file made the package importable.