Ghpy: how to use node-in-code with custom components


I’d like to use some custom components (that were written in VBnet and are available as .gha) inside a GhPython component as described here.
Lets assume the component I want to access is in the Foo-tab under Bar-category and the component itself is called FooBar_Baz

Here’s the question:
How do I call the component from python?
I’ve already tried multiple versions including
ghcomp.Foo.Bar.FooBar_Baz, ghcomp.Foo.FooBar_Baz, ghcomp.FooBar_Baz, but none of them work (ie python complains about not finding the given module or function.

Thanks in advance,

Hi @jws,

here some ideas to keep in mind:

  • If the functionality is provided as a .ghpy, its components will not be available (title of thread states ghpy). If they are in a .gha, they should be available.

  • The “Python module” name is derived from the Assembly name.

  • The object name is derived from the component Name name.

  • Not all components make sense to be used as functions. This is usually a case of whether the component store some internal state, such as a counter. In this case, it does not make sense to use it as a function.

  • If you want more help, you might be better off providing a sample so we can also test.



Giulio Piacentino
for Robert McNeel & Associates

thanks for the quick reply! Just for clarification:
I figured I can print the namespace with print dir(ghcomp). Will all the available components be listed there? In other words, if my component does not show up there, I cannot use it?

Thanks, Jacob

Components that are standard of Grasshopper are printed in order there. Third-party components are inside their own module. That means that, for example, that Weaverbird components are insider the ghcomp.WeaverBird. module.



Giulio Piacentino
for Robert McNeel & Associates

Right. Just for clarification: In my case, if I don’t see a ghcomp.Tekla module, I can’t use Tekla components? Or is there just something the Tekla developers did not do to make their components show up here?

Is there a public link to this Tekla component set? Btw, the assembly name is not the name of the Category, it’s the name of the assembly (the internal name in the GHA file).

Thanks for hanging in. With a little patience, I found my sought components in a module/namespace called GH_. So I guess, every accessible component is visible, its just a matter of locating it :slight_smile:.

– Jacob

Hi Jacob – not exactly, however that one is accessible under that name. Apparently, they chose that internal name for the assembly.