Updating Execute DATs that reference Extensions before callback definitions

Let’s say you’re referencing members of an extension in a CHOP Execute DAT outside of the callback function definitions, if you change those members, the Execute DAT is still holding onto an earlier version. In the attached tox, if you change the functions in the extension to print something else, the pulse parameters will still print the original messages, and you’ll see what I mean.

The execute DAT will update if you edit it, or if you right-click and select “run script”, but I’m curious if there’s another way to make sure these are always updated. I have quite a bit of this going on in a project I’m working on now, and sometimes find myself scratching my head when a refactor isn’t tracking through a call, until I realize it’s using an outdated object.

I had a similar issue when working on Vectorworks plugins, and there was some Python library that helped fix it, but their Python API working much differently (generally more tears involved :laughing:).

AutoUpdateRef.tox (838 Bytes)

That is intentional as the value variable gets set once the DAT, or in Python-Terms, the module, gets loaded. This means the script is run once, and all functions and variables get exported. Refferencing a member of your extension sets the variable to the value of that member. Afaik there is no way to set a variable to a refference of your member. (Pointers n stuff :wink: ).
In your case, you either refference the extension-member inside of your callback-function, or you create a helper-function that you simply call every time you want to access is. So

my_variable = my_operator.Extension_Attribute

becomes

my_variable = lambda : my_operator.Extension_Attribute

with the only distinction that you have to use my_variable() instead of my_variable