Check if Grasshopper is active using Python script

Is there a way to see if Grasshopper is active using pythonscript? And if it’s not active, to launch Grasshopper?
I’d assume it would be by checking if the grasshopper plug in is loaded or something but just have no idea where the right code to do this.

I think you’re looking for GH_RhinoScriptInterface.IsEditorLoaded:

import rhinoscriptsyntax as rs
gh = rs.GetPlugInObject("Grasshopper")
if gh.IsEditorLoaded():
    print "Grasshoppper is loaded"
else:
    print "Grasshopper is not loaded"

siemen.py (177 Bytes)

3 Likes

That’s it, thanks!