This is not possible in Python 2.7 due to how the PYTHONPATH
is constructed. See this question for an excellent explanation.
However nothing is impossible in python...
Thanks to PEP 420: Implicit Namespace Packages: this is indeed possible in Python 3.3 and up.
__init__.py
files are now optional for namespace packages:
Using Python 3.5 on Windows
a.py
b/
c.py
b/c.py
def hello_world():
print("Hello World!")
a.py
from b.c import *
hello_world
Then:
>>> import a
Hello World!
More information about the caveats of namespace packages versus regular packages can be found in the PEP and in David Beazley's excellent talk
Modules and Packages: Live and Let Die!