| Author |
Message |
westymatt *nix forums beginner
Joined: 18 Jul 2006
Posts: 3
|
Posted: Tue Jul 18, 2006 7:22 pm Post subject:
Defining functions in an implementation file
|
|
|
I am fairly new to python and I want to put alot of my functions in
another python file and import or from it into my script so I can call
the functions. How is this done? |
|
| Back to top |
|
 |
Diez B. Roggisch *nix forums Guru
Joined: 20 Feb 2005
Posts: 882
|
Posted: Tue Jul 18, 2006 8:00 pm Post subject:
Re: Defining functions in an implementation file
|
|
|
westymatt schrieb:
| Quote: | I am fairly new to python and I want to put alot of my functions in
another python file and import or from it into my script so I can call
the functions. How is this done?
|
import myfilefullofusefulfunctionsandclasses
Works if you have the file
myfilefullofusefulfunctionsandclasses.py
in your PYTHONPATH somewhere - usually, the current dir and some dirs in
the installation directory.
Diez |
|
| Back to top |
|
 |
Yu-Xi Lim *nix forums beginner
Joined: 31 Oct 2005
Posts: 13
|
Posted: Tue Jul 18, 2006 9:44 pm Post subject:
Re: Defining functions in an implementation file
|
|
|
westymatt wrote:
| Quote: | I am fairly new to python and I want to put alot of my functions in
another python file and import or from it into my script so I can call
the functions. How is this done?
|
What you are describing are modules. The Python Tutorial has some
information on this
http://docs.python.org/tut/node8.html |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|