Victor Hooi wrote: > Wait - err, subpackage != module, right? Do you think you could explain > what a sub-package is please? I tried Googling, and couldn't seem to find > the term in this context.
In analogy to subdirectory I em_load and pg_load -- and common if you add an __init__.py would be sub-packages, provided only the parent of foo_loading is in sys.path and you import them with import foo_loading.pg_load etc. > Also, so you're saying to put the actual script that I want to invoke > *outside* the Python package. > > Do you mean something like this: > >> sync_em.py >> sync_pg.py >> foo_loading/ >> __init__.py >> common/ __init__.py >> common_foo.py >> em_load/ >> __init__.py >> config.yaml >> em.py >> pg_load/ >> __init__.py >> config.yaml >> pg.py > > and the sync_em.py and sync_pg.py would just be thin wrappers pulling in > things from em.py and pg.py? Is that a recommended approach to organise > the code? I don't know. I prefer it that way. > Would it make any difference if I actually packaged it up so you could > install it in site-packages? Could I then call modules from other modules > within the package? If you mean "import", yes, installing is one way to get it into sys.path. -- https://mail.python.org/mailman/listinfo/python-list