Re: [Zope-dev] Organizing modules in a python product
Itai Tavor writes:
... abbreviated references to sibling subproducts ... Is there any way to set this up so imports like 'import Utils' and 'import Module2' would work in Module1? As a bonus, can I also get __init__.py files in each module directory to be executed? You can manipulate (extend) "sys.path" in your (top level) "__init__.py" file. Python starts its package/module lookup from the elements in "sys.path".
However, I doubt very much, that you should do this! You will lose the namespace isolation provided by packages. Dieter
Thanks, Dieter. You're right, I definitely wouldn't want to use this solution. I was hoping for something that can be done inside the product :-( Dieter Maurer wrote:
Itai Tavor writes:
... abbreviated references to sibling subproducts ... Is there any way to set this up so imports like 'import Utils' and 'import Module2' would work in Module1? As a bonus, can I also get __init__.py files in each module directory to be executed? You can manipulate (extend) "sys.path" in your (top level) "__init__.py" file. Python starts its package/module lookup from the elements in "sys.path".
However, I doubt very much, that you should do this! You will lose the namespace isolation provided by packages.
Dieter
-- -- Itai Tavor -- "Je sautille, donc je suis." -- itai@optusnet.com.au -- - Kermit the Frog -- -- "What he needs now is understanding... and a confederate victory" -- -- Dr. Jacobi, Twin Peaks --
participants (2)
-
Dieter Maurer -
Itai Tavor