Exit command not working when using a python subprocess to open RunPythonScript and run a script

I have read many posts that deal with this problem but nobody has given a solution yet.

Description:
I have 3 python files:

  • subprocess_main1.py --> open Rhino and execute the RunPythonScript1.py
  • RunPythonScript1.py --> run the script.py
  • script.py --> at the end it should make Rhino exit

I run the subprocess_main and at the end the rs.Command("-_Exit") is used but never be executed. So Rhino remains open!

Runpythonscript_Grasshopper1.py (2.8 KB) script.py (442 Bytes) subprocess_main1.py (397 Bytes)

The only thing needed is to change the paths of the files (–your path–)

Any help is appreciated!
Thanks.

Hi @tg1,

See if the attached is helpful.

create_random_circles.py (1.1 KB)

– Dale