I have see this in python tutorial:
The __init__.py files are required to make Python treat the directories as containing packages;
I make the directory hierarchy in pycharm like this, where the subdir1 doesn't contain __init__.py and subdir2 contains a __init__.py file.
First, I add Directory into system.pyth.
I write a hello function in hello1.py and hello2.py respectively.
Then I call hello func in test files like this:
# test1.py
from subdir1 import hello1
hello1.hello()
# test2.py
from subdir2 import hello2
hello2.hello()
They all succeed. It seems that the __init__.py does not necessary for import modules from different directories, right?
So, I want to know in what situation a __init__.py is required. Thanks for your answering!