In a linux terminal typing
python script.py
Will run run script.py
and exit the python console, but what if I just want to run a part of the script and leave the console open? For example, run script.py
until line 15 and leave the console open for further scripting. How would I do this?
Let's say it's possible, then with the console still open and script.py
run until line 15, can I then from inside the console call line fragments from other py files?
...something like
python script.py 15 #(opens script and runs lines 1-15 and leaves console open)
Then having the console open, I would like to run lines 25-42 from anotherscript.py
>15 lines of python code run from script.py
> run('anotherscript.py', lines = 25-42)
> print "I'm so happy the console is still open so I can script some more")
I'm so happy the console is still open so I can script some more
>