path to modules per import statement

danmcleran at yahoo.com danmcleran at yahoo.com
Thu Mar 23 16:37:52 CET 2006


As an example, let's say you have a main module at /usr/code/Main.py
and you have a module you'd like to import at /usr/code/util/Util.py,
you can do this:

import util.Util

If you are using PyDev and Eclipse to develop your Python code, you can
set the base directory to reference module imports from.

You can also tweak your PYTHONPATH if you want to import modules from
other directory structures.




More information about the Python-list mailing list