How to load custom-written components by import ghpythonlib.components as gh


I have some compiled custom Grasshopper component in the folder C:\Users\Administrator\AppData\Roaming\Grasshopper\Libraries and I want to use these components in Rhino Python Editor. However, I cannot do that since ghpythonlib.components cannot find my components.

May I know how to solve this issue though?


Can you see your components in Grasshopper? If not, then Python can’t access them.

Hello @Ayoub,

Yes, I can see these custom components under the Grasshopper tabs


Then it should be possible to call it. Here is the basic syntax:

import ghpythonlib.components as gh
# An example with the Weaver Bird plugin
outputPolygons = gh.WeaverBird.WeaverbirdsFacePolylines(inputMesh)

If you still can’t find it, maybe you can upload your plugin so we can have a look?

No, the PLUGIN_NAMESPACE is not available. I have attached that component in this post. As you can see, I can see this component in the Grasshopper tab.

downDraft_a5a3b916df2248dd950f40bcd3e46481.ghpy (68 KB)

GhPys are currently excluded from NodeInCode. They also have another purpose. I’ve answered this other question: Import .ghuser component