MegaMain is my project's name ,flaskStart is my gateway's event.
inside flaskStart ,my dedicated gateway's event :
import subprocess
import os.path
# Create the command
command = ["C:\Program Files\Git\git-bash.exe", "C:\ML\ML_MENABEV\launch.sh"]
# Use subprocess to run the command
process = subprocess.Popen(command)
I am trying now to test some simple codes inside gateway's event like :
system.util.execute(['notepad.exe', 'C:\Program Files\Inductive Automation\Ignition\Notice.txt'])
to check my gateway's response and for example ,this text file is not opened in my gateway's machine.
Ignition runs as a service and Windows does not allow services to start new processes that have user interfaces.
To be clear, system.util.execute does work when run in the context of the Ignition Gateway - you just can't expect anything with a UI to open and be visible.
Thanks Kevin , I found a way to run py code in the gateway , by creating new task scheduler that run the bash file in gateway machine ,and call it from perspective session as below :
import system
# Define the name of the scheduled task
task_name = "RunBashScript"
# Define the command to run the scheduled task
command = ['cmd.exe', '/c', 'schtasks /run /tn "{}"'.format(task_name)]
# Execute the command
system.util.execute(command)