following Blenders documentation from the following link:
I am trying to adapt the example to add a subscription to a custom property as follow:
import bpy def notification_handler(*args): # This will print: # Something changed! (1, 2, 3) print("Something changed!", args) if __name__ == "__main__": subscription_owner = bpy.types.Collection subscribe_to = bpy.context.scene['myproperty'] print(subscribe_to) bpy.msgbus.subscribe_rna( key=subscribe_to, owner=subscription_owner, args=("example argument",), notify=notification_handler, options=set(["PERSISTENT"]) )
Then, in the python console, I execute the following command:
bpy.context.scene['myproperty'] = "new value"
And I see that the value changes in the UI but there is nothing printed in the console (I launch Blender from the CLI).
I suspect that the values of
subscribe_to are not totally correct, but I don't know how to continue.
Anyone knows how to do it?