This is usually for some quick testing.
-
python -i myscript.py
Then you can reference functions and variables in the script directly.
-
While you are already in a Python shell:
2.1.
import myscript
Then you can reference functions and variables in the script by prefixing with
myscript.
.2.2.
-
python2:
execfile('myscript.py')
-
python3:
exec(open('myscript.py').read())
Then you can reference functions and variables in the script directly.
-