Because there is an __init__.py
file in /p
. This file tells Python: "All modules in this folder are in the package p
".
As long as the __init__.py
file exists, you can import b
as p.b
, no matter where you are.
So the correct import in b.py
would be: import p.a