I want to call a method of an operator when a scene property has changed.

I know there is an update callback:

bpy.types.Scene.h_dock = bpy.props.EnumProperty(
    items = h_dock, name="Dock", 
    description="Dock to left or right side", 
    default="0", update=???)

But how to add a method of an operator here or any other class/instance in which I have to update member variables?


  • $\begingroup$ You have to write a function which takes 2 arguments (self, context) and executes whatever you need - and pass it as the 'update' argument $\endgroup$ May 28, 2021 at 22:07

1 Answer 1


here is how i did it in my addon, i registerd my property's in directly in the register def and made a def at the top of my script that gets called when the value of the property changes

def Update_BoolProp(self, context):
bpy.types.Object.BoolProp = bpy.props.BoolProperty(
    default = True,
    update = Update_BoolProp

i think that you can define the update function where ever you like as long as you can access where you define your property's.

ps: your vids are really helpful

  • 1
    $\begingroup$ Cheers. Unfortunately now you have turned it into a recursion loop, by updating the property in its own update method. A good way to toggle bools is flag = not flag $\endgroup$
    – batFINGER
    Mar 15, 2019 at 10:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .