Reputation: 6756
Why python load my module from directory, even if the directory shouldn't be treated as a package (doesn't contains __init__.py
)?
app
main.py
fake_module
module.py
this works, even if fake_module
doesn't contains __init__.py
import fake_module.module
If i would create regular fake_module
with __init__.py
and module.py
file somewhere in sys.path
, will be module.py
loaded from this regular fake_module
package?
I am using pycharm and python3.3
Upvotes: 1
Views: 221
Reputation: 41950
It looks like the __init__.py
is optional as of Python 3.3. See also PEP420.
Upvotes: 7