Check if Grasshopper is active using Python script

#1

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.

#2

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)

2 Likes
#3

That’s it, thanks!