Reputation: 711
I'ld like one of these:
Starting python with a script like python my_routines.py
and let python enter the interactive state while the code in my_routines.py
have been loaded/run.
Starting python in the interactive mode and loading in some convenient(short and easy to remember) way my_routines.py
the idea is, of course, that I want to preload some stuff and then play around with it in the interactive mode.
Suggestions involving loading a module (python -m ....
) don't have to apply ;-)
Looking forward to your ideas!
Twan
Upvotes: 1
Views: 1891
Reputation: 29071
To continue in REPL after running the script, run it with python -i test.py
, where -i
stands for interactive.
For loading from inside the REPL, you could use exec
, but your best bet is to use ipython
and its %load
command. (ipython is an improved repl, so you should be using that anyway)
Upvotes: 8