| | |
Calling a Script
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Mar 2007
Posts: 2
Reputation:
Solved Threads: 0
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.
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.
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
http://www.daniweb.com/techtalkforum...287241-87.html
May 'the Google' be with you!
![]() |
Similar Threads
- Safe Array (C++)
- Help needed working with prototype.js and php (JavaScript / DHTML / AJAX)
- DOS Batch command to ping network IP (Legacy and Other Languages)
- VBscript in a Visual Basic Application (Visual Basic 4 / 5 / 6)
- inline c++ cant locate object new (Perl)
- Scripting (Perl)
- Dani Web 404 Error File Not Found (DaniWeb Community Feedback)
- Problems writing script which checks the users group and date (VB.NET)
Other Threads in the Python Forum
- Previous Thread: Tkinter Image Problem
- Next Thread: How to get http headers?
Views: 1629 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for Python
accessdenied address ansi backend beginner changecolor class code conversion coordinates copy curves customdialog dan08 dictionary directory dynamic edit examples excel feet file float font format ftp function generator getvalue gui halp homework i/o images import info input ip java line linux list lists loop mouse mysql newb number numbers output panel parsing path port prime print program programming projects py2exe pygame pyqt python queue random rational recursion recursive schedule screensaverloopinactive scrolledtext searchingfile server ssh stamp statictext string strings sudokusolver table terminal text thread threading time tkinter tlapse tuple tutorial type ubuntu unicode url urllib urllib2 variable whileloop windows write wxpython






