Run GH definition from an external python script using python rhinoinside

hello, I’ve been trying to use an external python script to start a grasshopper definition using the python rhinoinside module.

so far it isn’t working and I can not figure out why, it is crashing in the openDocument.

here is the code:

import rhinoinside
import clr

# Load Rhino.Inside

# Import necessary namespaces
import Rhino
import Grasshopper

# Load the Grasshopper document
gh_file = r"C:/Users/abc/Desktop/"
gh_doc = Grasshopper.Instances.DocumentServer.OpenDocument(gh_file)

# Set input parameters
input_params = gh_doc.Objects.OfType[Grasshopper.Kernel.Special.GH_NumberSlider]()

for param in input_params:
    if param.NickName == "Slider1":
        param.Slider.Value = 5.0
# Compute the Grasshopper document

# Get the output parameters
output_params = gh_doc.Objects.OfType[Grasshopper.Kernel.Special.GH_NumberParam]()

for param in output_params:
    if param.NickName == "Output":
        print(f"Result: {param.VolatileData.AllData(True)[0]}")

has anyone been able to do this?
Thanks in advance.

Don’t you get an error message?

Whihc external Python are you using that supports both clr and f strings, does Iron Python 3 do that?