944,159 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Marked Solved
  • Views: 2531
  • Python RSS
Mar 13th, 2007
0

Calling a Script

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Suplexx is offline Offline
2 posts
since Mar 2007
Mar 13th, 2007
0

Re: Calling a Script

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
Moderator
Reputation Points: 1333
Solved Threads: 1404
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: Tkinter Image Problem
Next Thread in Python Forum Timeline: How to get http headers?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC