Reputation: 551
Is there a way to run a python module from command line ( -m option, which imports and runs a module ), and then enter the interactive mode?
I need something similar to "cmd /k command".
I tested the -i option, but it didn't work; I'm not sure but it seems just redirects in_stream from input.
Upvotes: 4
Views: 3744
Reputation: 3377
You need to put the -i
before the -m
.
The -m
option is an interface option; it terminates the option list and all subsequent arguments will end up in sys.argv
for the module's main
function. (link to doc)
Upvotes: 3
Reputation: 1828
Or go into interactive mode and run your python file:
import <filename>
Upvotes: 1
Reputation: 53545
You can use bpython in the following way:
bpython -i <filename>
which will load the module and get into interactive mode
Upvotes: 0