Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 connecting different python files
Index -> Programming, Python -> Python Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
shaon




PostPosted: Tue Mar 11, 2008 7:27 pm   Post subject: connecting different python files

I have a lot of files which have a ton of useful functions and classes that I made over time. I don't want to have to copy and paste them into a new python file every time. Is there a built-in-function which can link files together?
Sponsor
Sponsor
Sponsor
sponsor
Nick




PostPosted: Wed Mar 12, 2008 1:29 am   Post subject: RE:connecting different python files

import [filename without extension]
McKenzie




PostPosted: Wed Mar 12, 2008 8:19 am   Post subject: Re: connecting different python files

And it works the same as built-in modules too. If you want to dump your functions into the current namespace use:
code:
from utilities import *

(if utilities.py had your functions in it)
Display posts from previous:   
   Index -> Programming, Python -> Python Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: