That’s exactly right.
I’m using one of several methods for creating persistent variables (i.e. that do not “reset” from iteration to iteration) in GHPython. See the links in this post for context:
Generally speaking, when modelling dynamic systems you need at least:
A) Some persistent variable mechanism (i.e. to manage the state of your system/agents)
B) Some update mechanism (i.e. to step the system into the next iteration)
In GHPython, problem A can be solved using at least two methods: Notably the component local if "foo" not in globals() method, and the Rhino global sticky method. Both are covered in this old thread , and I’d recommend using the former, unless you need to read the …
Edit: Just in case you miss it in the sea of links there, have a look at this old thread:
opened 09:14PM - 24 Oct 13 UTC
closed 10:32AM - 03 Nov 17 UTC
needs testing
I have been wondering about this one for some time now actually. If you create a… variable, run the script and subsequently delete the variable. The variable still exist in globals().
Is this by design? If so, is there a good reason for this that I might be missing? If not, I propose this issue be considered a bug.
Thanks again for all the hard work,
Anders