Peter Otten wrote:

>> I'd appreciate hearing of what I can do in an __init__ file or what
>> other strategy could make this work. Many thanks.
> 
> I think fixing the imports is the better long-term approach. But putting
> 
> from pkgutil import extend_path
> import mypackage
> __path__ = extend_path(mypackage.__path__, __name__)
> 
> into dependentpackage/__init__.py might work.

One big caveat: If you are mixing both

import mypackage.somemodule

and

import dependentpackage.somemodule

in the same application, mypackage.somemodule and
dependentpackage.somemodule are *not* the same module instance. This may
have surprising effects when global variables in somemodule.py are
updated...

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to