How to run the script when other operation is call

i want to run my script every time that somethinig happen, lets say that every time that the shapekys is change i also want to run my script, or every time that the frame change i want to run my script.
what i was thinking is to run the script all the time like in the draw function and check if someting change, but i think it can be very hevy and i dont know how to that, so if somebody can help me and maybe give me a better solution i will thank him alot

some things have app.handler callbacks (frame change for example)- where possible you should use those. checking for changes in the scene can either be inexpensive or completely crippling to performance, depending on what type of changes you are trying to detect.

1 Like

thx! that exactly what i search!