niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » python
Defining functions in an implementation file
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
westymatt
*nix forums beginner


Joined: 18 Jul 2006
Posts: 3

PostPosted: Tue Jul 18, 2006 7:22 pm    Post subject: Defining functions in an implementation file Reply with 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?
Back to top
Diez B. Roggisch
*nix forums Guru


Joined: 20 Feb 2005
Posts: 882

PostPosted: Tue Jul 18, 2006 8:00 pm    Post subject: Re: Defining functions in an implementation file Reply with quote

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

PostPosted: Tue Jul 18, 2006 9:44 pm    Post subject: Re: Defining functions in an implementation file Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 7:00 am | All times are GMT
navigation Forum index » Programming » python
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Running php file everyday on scheduled time sachin PHP 1 Fri Jul 21, 2006 12:49 pm
No new posts Regarding thesaurus iso file Srikanth modules 0 Fri Jul 21, 2006 10:42 am
No new posts how can i get a file descriptor not used? mars system 0 Fri Jul 21, 2006 7:41 am
No new posts small GTK "Open file" dialog David Siroky Debian 0 Fri Jul 21, 2006 7:30 am
No new posts Trouble Declaring 3D Array in Header File free2klim C++ 1 Fri Jul 21, 2006 4:07 am

Bad Credit Loan | Loans | Remortgages | Loans | Loans
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1595s ][ Queries: 16 (0.0852s) ][ GZIP on - Debug on ]