organizing many python scripts, in a large corporate environment.

eryksun () eryksun at gmail.com
Sat Mar 12 01:14:17 EST 2011


I'm not an expert at Python packaging, but assuming a structure such as

folder1
       \
        __init__.py
        module1.py
folder2
       \
        __init__.py
        module2.py

Then from the root folder I can run 

python -m folder1.module1

and within module1, I can import from module2, e.g.:

from folder2.module2 import foo

The __init__.py files are empty. They make Python treat the folder as a package namespace from which you can import, or execute a module directly with the -m option.

--
EOF



More information about the Python-list mailing list