3

Is there a command line switch to carry out the script specified without terminating the process at the end?

Windows' cmd.exe for example has the /K switch.

iTayb
  • 12,373
  • 24
  • 81
  • 135

3 Answers3

6

As stated on python's manual:

-i switch

When a script is passed as first argument or the -c option is used, enter interactive mode after executing the script.

Community
  • 1
  • 1
iTayb
  • 12,373
  • 24
  • 81
  • 135
1

One option is to add code in your script to drop into an interactive prompt. See this answer.

import code
code.interact(local=locals())
Community
  • 1
  • 1
snapshoe
  • 13,454
  • 1
  • 24
  • 28
-2

No, it doesn't have such an options. See the Python commandline options documentation.

Depending on what you want to do, you can use a shortcut, or write a wrapper module and call the script you want to run through it with the -m option.

cha0site
  • 10,517
  • 3
  • 33
  • 51