Max Davies
Max Davies

Reputation: 148

Is there a way of opening an external .exe which doesn't pause the rest of the program? python

I am writing a python program (3.8) which is automatically filling in certain options in a command window using a menu format. For example, when prompted with

enter image description here

It would fill the correct option (either 1 or 2).

Currently, the .exe file must be opened separately from the python file which is a hassle. To remove this I tried using subprocess like this.

import subprocess 
subprocess.call([r'C:\Users\file\location\that\ends\right\here\VSCaptureMP.exe'])

but it pauses the entire program until the .exe window is closed. The rest of the program (the automatic writing part) never gets to run when using this format.

I know there is an after module when using tkinter. Is there a similar option for this scenario?

Upvotes: 0

Views: 165

Answers (1)

mahieyin-rahmun
mahieyin-rahmun

Reputation: 1657

Use subprocess.Popen

import subprocess

print("Hello")
subprocess.Popen([r"C:\Windows\system32\mspaint.exe"])
print("This is non-blocking!")

Upvotes: 1

Related Questions