I need help in closing my simulation automatically, this program only close my flowgraph if i run it alone, but if I also run the simulation then after 5 seconds nothing will be end. Please help. Thanks
import subprocess
import time
import sys
gnuradio_companion_path = "/usr/bin/gnuradio-companion"
grc_file_path = "/home/usama/Usama/correlation/PN_correlation.grc"
open_command = [gnuradio_companion_path, grc_file_path]
process = subprocess.Popen(open_command)
run_command = ["grcc", "-r", grc_file_path]
run_process = subprocess.Popen(run_command)
time.sleep(10)
print("Hello")
run_process.kill()
process.kill()
process.kill()
sys.exit()
subprocess.run(["pkill", "-f", "PN_correlation.grc"])
subprocess.run(["kill", "-9", "PN_correlation.grc"])
pyautogui.hotkey('alt', 'F4')