about python modules

Roy Smith roy at panix.com
Wed May 21 08:40:37 EDT 2008


In article 
<2fc55c56-7408-4f44-b6e2-64f85f341ac9 at i36g2000prf.googlegroups.com>,
 srinivas <srinivas.puvvala at gmail.com> wrote:

> hi friends i am new to python programming.
> i am using Python 2.5 and IDLE as editor.
> i have developed some functions in python those will be calling
> frequently in my main method .
> now i want to know how to import my functions folder to python in
> sucha way that the functions in functions folder should work like
> python library modules .
> 
> i have  python in folder C:\python25\..
> and functions folder D:\programs\Functions\
> 
> pls help me friends how to do that.

You need to either:

1) Put your modules in some directory that's already on your python path.  
To find out what your path is, do:

import sys
print sys.path

It should include a directory which ends in "site-packages".  Just drop 
your modules into that directory.

2) Add the directory where you modules are to your python path.  The 
easiest way to do this is to set PYTHONPATH in your environment.



More information about the Python-list mailing list