1

I wrote this code:

import subprocess

subprocess.call(["notepad.exe"], creationflags=subprocess.CREATE_NEW_CONSOLE)
print('I continue working.')

but until i close notepad my script won't continue running. How to open file and continue running script without closing this file?

1 Answers1

1

For that you use the subprocess.Popen method like this:

process = subprocess.Popen("notepad.exe", shell=True, stdin=subprocess.PIPE)

You might want to read about pipes and delve deeper into the subprocess module, in case you want to interact in any way with the processes you call using that function.

Related question: How to start a background process in Python?

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
jonasfs
  • 26
  • 3