I have several Python packages that I'd like to keep on separate filesystems but which unfortunately share the same top-level module name.
To illustrate, the directory structure looks like this:
/fs1
/top
__init__.py
/sub1
__init__.py
/fs2
/top
__init__.py
/sub2
__init__.py
In Python 2.7, is there any way I can set up my PYTHONPATH so that I could import both top.sub1 and top.sub2 into the same script? Adding both /fs1 and /fs2 doesn't work, since it only allows one of the two submodules to be imported (whichever comes first on PYTHONPATH).
I could copy/symlink the two trees into one, but for practical reasons I'd rather not do that.
toppackage has to be empty, that namespace can not contain anything except the sub1 and sub2 packages.