How do I run the REPL at the end of a python script?
2 answers
If you do this from the command line, just use -i
:
โ Desktop echo "a = 50" >> scrpt.py
โ Desktop python -i scrpt.py
>>> a
50
this calls Python after the script is executed.
Alternatively, just set PYTHONINSPECT
in True
in your script:
import os
os.environ['PYTHONINSPECT'] = 'TRUE'
+2
source to share