Parallel package hierarchies/directories

atleta atleta.hu at gmail.com
Sat Jan 17 00:29:50 EST 2009


OK, I'm answering my own question, it might be of some help for
someone in the future: yes, it's possible to have parts of the same
package in multiple directories, it's just not enabled by default. To
make it work each such package should have the following code in their
__init__.py:

from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

Actually pkgutil's documentation explains this quite clearly:
http://docs.python.org/library/pkgutil.html (It's easy if you know
where to look ;) )

  Laszlo



More information about the Python-list mailing list