Notifications
Clear all

[Closed] Py3dsMax: global functions

So I am trying to make some stuff work from a python script, and I’d like to use callbacks, which need a global function to work. So far I have this:


 mxs.callbacks.addScript(mxs.pyhelper.namify("selectionSetChanged"), "addChangeHandlersToSelected()", id = mxs.pyhelper.namify("objectWatcher"))
 
 and it works in adding the callback, but it does NOT find the  function "addChangeHandlersToSelected" because that is a python function  of my class. How do I declare this as a global function that is found  in 3ds Max by the callback?

I thought about something like: 

 mxs.execute("global addChangeHandlersToSelected")
 
prior, so the variable name would be global and the function would fill it afterwards, but it did not work.


Cheers