Python component global variable value update

Hi everyone,

I set up a global variable with a number slider using the sticky function in scriptcontext module.
However, I found that the value of the variable doesn’t update immediately when I am changing the value of the number slider. I need to press F5 to refresh the value everytime.
Can this be solved?

Thank you
Ray

provide example please
I’m guessing you may be assigning values incorrectly. sticky is a dictionary (or works like one) and not a function

Um… so is there any other ways to define an actual global variable in Grasshopper?

Thank you so much

Hmm this link seems to suggest your method should work, with a caveat about having multiple documents open at once and associated workaround. :thinking:
It also suggests another method with (optionaly hidden) wires.

You will still need to expire any component that reads the sticky dict value (using wires or events). And as always, providing an example helps with troubleshooting/suggestions.

I got it.

Thanks for your help guys !