I have a python script myscript that when run it "stays open" with a GUI. I would like to write a python script launching myscript two times like this:
bash>python runNTimes.py 2
I have the following code for runNTimes.py
import subprocess
for i in range(int(sys.argv[1])):
subprocess.call(['python', 'myscript.py'])
The problem is that this happens synchronously, i.e. once I launch the first in a subprocess the second subprocess is not launched until the first terminates.
A minimal example for myscript.py:
try:
import Tkinter as tk # for Python2
except:
import tkinter as tk # for Python3
win=tk.Tk()
win.mainloop()