importing custom modules

Chris Liechti cliechti at gmx.net
Fri Jul 19 15:01:51 EDT 2002


xeon at dacreations.cjb.net (xeon) wrote in 
news:c21a43ff.0207191038.4f115531 at posting.google.com:

> I'm new at python. I'm under the impression that 'import' searches the
> lib directory as defined in PYTHONPATH env. variable.

almost. it searches the directories in sys.path. PYTHONPATH is used to add 
direcories to that list.

> Is there any way
> to load my own modules located outside the lib directory, but leaving
> the lib modules access intact (without changing the env. variables),
> from inside the intepreter?

e.g. to add the parent directory:

sys.path.append(os.path.abspath(".."))

chris

-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list