How can I import functions from another python file

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Apr 9 17:58:31 EDT 2007


En Mon, 09 Apr 2007 18:06:11 -0300, yinglcs at gmail.com <yinglcs at gmail.com>  
escribió:

> i have 2 python files in *different directory* , how can I import
> python functions from 1 python file to another?

See the tutorial about modules, packages, and the module search path:  
http://docs.python.org/tut/node8.html
You can extend the search path using .pth files:  
http://docs.python.org/lib/module-site.html
(but consider using packages instead of cluttering your search path with  
infinite entries)

-- 
Gabriel Genellina




More information about the Python-list mailing list