There is a program I need to launch multiple times and pass it different arguments each time. To do this I tried writing a simple python script as follows:
import sys, os
from os.path import join
# This works, but will not launch twice
os.system('./AppName.app -AppCommandLineArg')
# This allows launching two instances but without command line arguments
os.system('open --new --background ./AppName.app')
# Attempt #1
os.system('open --new --background ./AppName.app -AppCommandLineArg')
# Attempt #2
os.system('open --new --background "./AppName.app -AppCommandLineArg"')
# Attempt #3
os.system('open --new --background "./AppName.app/Contents/MacOS/AppName -AppCommandLineArg"')
The reason I'm using 'open' is to be able to launch the app multiple time. Is 'open' the correct command to use? Any suggestions on how to do this? Working with linux/mac is very new to me.
Thanks!
Edit - Here is the code that solved the problem for me:
p0 = subprocess.Popen(['./AppName.app/Contents/MacOS/AppName', '-AppCommandLineArg'])
p1 = subprocess.Popen(['./AppName.app/Contents/MacOS/AppName', '-AppCommandLineArg'])
Cheers!