Calling a Script

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Mar 2007
Posts: 2
Reputation: Suplexx is an unknown quantity at this point 
Solved Threads: 0
Suplexx Suplexx is offline Offline
Newbie Poster

Calling a Script

 
0
  #1
Mar 13th, 2007
I'm somewhat new to Python and want to clear a few things up regarding running scripts.

Alright, so here's what I want to do: I want to run a script inside of a script, and then have the first "parent" script continue running normally. I have tried using both execfile() and import file.py but they both jump to the next script and disregard the rest of the first. What I'm basically trying to do is save some code in a script, and then run the code in another script so I don't have to type that code again in the current script. Does this make sense? I can post an example if it will help clear up what I want. Any help would be greatly appreciated.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,145
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 949
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: Calling a Script

 
0
  #2
Mar 13th, 2007
I think you are talking about a bread and butter item of Python. Your child-script is called a module and you import into your parent-script. Take a look at:
http://www.daniweb.com/techtalkforum...287241-87.html
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum


Views: 1629 | Replies: 1
Thread Tools Search this Thread



Tag cloud for Python
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC