When I call a os.system()
command in python, it executes the system command and waits for it to finish, then continues executing the rest of the code. I don’t want this wait, I want to execute a system command then continue executing the program even if the system command didn’t finish. Any help?
Asked
Active
Viewed 368 times
0

martineau
- 119,623
- 25
- 170
- 301

Karim Fadi
- 27
- 2
-
1Use the subprocess module. – Klaus D. Jun 19 '21 at 23:32
1 Answers
1
You need to use a subprocess and basically run two different parts of the program concurrently. One part will wait for the System call to finish its job and the other part continues executing the rest of the code. However, It's not a simple task especially if you are not familiar with async programming.
If you really want to work your way around it, I suggest reading this article by TutorialsPoint as it explains parallel programming in python thoroughly. Also, I suggest reading subprocess.Popen(args)
docs here as it might get you up and running fast.

ARK1375
- 790
- 3
- 19