I have a Python script which runs terminal commands to complete tasks. At one point in the script, I start a wifi network and everything sets up just fine, but the terminal will leave a blinking cursor and not accept any further commands (as the wifi command remains running). I may type other commands and hit enter, but nothing will happen. The only way to continue my script is to hit Ctrl+Z to stop the wifi command. This then allows the script to continue to run without any issues.
Is there a way to open a new process or terminal window to run a specific terminal command so that I may continue to run commands from Python on a main window?
EXTRA ANSWER: You can use something called threading in python. This will let you run commands and functions separately while continuing the main script.
&
at the end of the command.subprocess.Popen
rather thansubprocess.call
- the former is non-blocking. See for example What's the difference between subprocess Popen and call (how can I use them)?.