2

In my code I would like to launch a function/script in another python window (say, when you run one script, a back window pops up, I want that script to manage other scripts. They don't need to communicate).

Similar to multiprocessing but they have their own pop up windows and outputs. All their information is going to be written to a file there after.

I have searched a fair amount but it seems like no one want a script to run another script in another window, potentially running 4 or 5 python windows consecutively, each using a separate core.

TheMaster
  • 45,448
  • 6
  • 62
  • 85

1 Answers1

1

You should be able to use os.startfile(filename) Here is an example that runs another python file:

import os

os.startfile("File.py")

print("Started Running!")

This will open and run another python program, allowing this program to continue running.

Timmy Diehl
  • 409
  • 3
  • 16
  • Be aware that `os.startfile` only works on Windows. Furthermore, it doesn’t *execute* a file, it opens it with its associated application. For a Python file that might well be an editor or IDE, depending on how the system is configured. – Konrad Rudolph Feb 01 '22 at 22:14
  • This works perfectly! I did try os.start but not startfile! Thank you so much, you've saved me a massive headache! – Names Are Too Mainstream Feb 01 '22 at 22:42