path to modules per import statement

danmcleran at danmcleran at
Thu Mar 23 16:37:52 CET 2006

As an example, let's say you have a main module at /usr/code/
and you have a module you'd like to import at /usr/code/util/,
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