onCook callback: python error

Hello,

I am using Python to execute multiple in scene cameras on command.

Using this script in TD Vers. 2021.15240 works fine but trying TD Vers. 2022.29530 and beyond spits out the same error in the script —

‘Line19, In onFrameEnd’
tderror: Expected locked operator, or execution within onCook Method of a Script Operator.

I have attached the python script and .toe.

I expect this code needs revising to successfully run within the current version of TD, although I am not sure how?

Any suggestions will be a great help, thanks

dat_execute1__td_60081_1.py.zip (899 Bytes)
class_hanson.toe (128.4 KB)

You can no longer modify the contents of a Script operator outside of it’s onCook callback. You should move your code into the onCook callback for that node instead. If you want it to execute that code at a particular time, then call cook() on the script operator

Thanks Malcolm,
So its to do with where the script operator is located, so all code should be moved to the one location - the same as the onCook callback for each node?

I have to admit I am new to coding, do you know if a fix for this issue was clearly explained anywhere in the forum or on the derative website? as I could really do with an example to follow to help me clean up these errors.