Grasshopper

algorithmic modeling for Rhino

Hi everyone,

I have some functions that I would like to use in multiple components and I have therefore made a python script that I can import into the components so I don't need to copy paste the functions into every component.  

One of the functions have this line:

scriptcontext.doc = ghdoc

When I run the component, where the function is called, I get an error saying the global variable ghdoc is not defined. How do I reference ghdoc correctly in my python script?

Views: 492

Replies to This Discussion

I don't understand the question... Where are you running this code?

Is it another module? If so, you don't get to reference this module attribute from there. But you can pass it out as an argument when you call something in the other module. Does it help?

Alternatively, you can set it in the component itself, before going into the other module. It should make no difference.

Thanks!

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service