Opening a Python thread in a new console window

Viewed 21659

I am trying to make a program that will launch both a view window (console) and a command line. In the view window, it would show constant updates, while the command line window would use raw_input() to accept commands that affect the view window. I am thinking about using threads for this, but I have no idea how to launch a thread in a new console window. How would I do that?

3 Answers

UPDATED ANSWER:

import subprocess
command = "dir"
subprocess.run(["cmd.exe", "/c", "start", f"{command}"], timeout=15)

"cmd.exe" - if using Windows, Windows ONLY recognizes double quotes.
"/c" - says 'send the Return' after we send the 'dir'(for example) string.
"start" - says open new console window...even if debugging in Pycharm :)
f"command" - I use f-strings to send assemble strings Python3.6+
(timeout optional)

Related