How can I import one Function(or one Class) from another GHPython component?

Hello all!:grinning:

I’m trying to write several GHPython component work together.
How can I import one Function(or one Class) from another GHPython component that I wrote before?
I want to share functions or Class in different GHPython component while I put them together in the same grasshopper canvas.

PS: I saw “LadyBug” has to drag a basic component first which contains some basic class. But I can’t figure out how to achieve that.

Hi @RetroPost.LT,
Main Ladybug component instantiates all its classes and assigns those to certain keys of the sticky dictionary.
Then inside all of your other ghpython components, you check at the very beginning weather those keys from the sticky dictionary exist. If they do not, you raise a message of the necessity of main Ladybug component being dropped to the canvas, first.

Thank you djordje! That’s what I want. Really helps a lot :>

1 Like