functions - where to store them
tjreedy at udel.edu
Wed Mar 11 20:47:40 CET 2009
plsullivan1 at gmail.com wrote:
> I have several functions which I would like to store in a different
> directory so several programs can use them. I can't seem to find much
> information about how to call a function if the function code is not
> actually in the script itself.
> The problem: do I have to cut and paste functions into a script or can
> I store them in a directory and call them from a script in another
> directory. If the latter is possible, how is this done? Thanks.
After you follow the other suggestions of read about 'module' and
'package'.... If you want a module or package available to *all*
programs (that run with a particular version/installation of Python),
you can put your module or packages in the 'site-packages' directory.
On Windows, this is a subdirectory of pythonxy/lib/
>>> import sys; sys.path
More information about the Python-list