I understand from How do I run a Python program? that in command prompt i can use
C:\python>python first.py
, to run first.py
.
But, is it possible, that after i entered the interactive python prompt, by runnning
C:\python>python
and see the >>>
python indication, run first.py
, and after finished running first.py
, back to the interactive python prompt, I could see variables defined inside first.py
?
For example, if first.py
created some variables inside, e.g. by
(x,y) = [3,5]
, is it possible that after running first.py
and back to the interactive python prompt, x
and y
are still there?
Running windows shell commands with python shows how to run the windows shell command in python, so in the interactive python prompt, i could actually use
>>>os.system('python first.py')
to run first.py
, but x
and y
defined inside are lost after running.