简体   繁体   中英

Opening and executing python scripts on new terminal windows

I want to, from a python script, open a new terminal window. Then, on that new window, run another python script, located on the same directory. I needs to be on another window, because both scripts have while True loops, and I need them to run simultaneously. How would I do that? Thanks everyone!

You can just spawn an xterm with the python code used:

xterm -e "python /path/to/your/file.py"

This will close when the process ends.

If you need to, you can do this from inside a python script using the subprocess module ( https://docs.python.org/2/library/subprocess.html ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM