Automatic px4 launch & kill

Hi all! I am trying to write a code on python that automatically opens and closes px4. I managed to successfully open px4, using subprocess or os library. However, when the script kills the px4 process, the python process is also automatically killed. Does anybody knows a way to kill px4 from python without killing the python process itself?
I am using gazebo 11 and v.1.11.3 of px4, with ROS noetic on Ubuntu 20

1 Like

Have you been able to find a solution for this yet? I am trying to do something similar and am stuck. Would appreciate some inputs or help. I have been able to use a python code to open px4 with jmavsim Headless. I want to open another terminal from where I can run mavlink commands simultaneously. But am unable to do the second step once px4 starts executing. I have px4 installed on MACOS.