define module in non-standard location?

Shane gshanemiller at verizon.net
Sun Oct 16 22:43:20 EDT 2011


Normally if one has a code set under a directory "top_level" like
this:

top_level:
   __main__.py
   a
      __init__.py
      b
         __init__.py

then this directory structure is naturally satisfies this line in
__main__.py:

>import a.b

But support, for some stupid reason --- say a.b is user defined code
--- that I want
to locate modules a and a.b somewhere else under another directory
"other_top_level".
What would the line "import a.b" in __main__,py be replaced by?

Thank you



More information about the Python-list mailing list