# Why does an update function loop when string property is reset?

I have a string property, when it is updated it runs a function which runs an operator, the operator clears the string at the end to reset it. This makes the function (string_update) loop to infinite recursion. As I understand, order of events should be:

update string
run function once
run operator
finish

What am I missing?

import bpy

def string_update(self, context):
bpy.ops.test.test()
print("Ran")
return None

class test_vars(bpy.types.PropertyGroup):
test_update_string = bpy.props.StringProperty(
name = "",
default = "",
update = string_update
)

class Test_Op(bpy.types.Operator):
""""""
bl_idname = "test.test"
bl_label = "test"

def execute(self, context):
bpy.context.scene.test_vars.test_update_string = ""

return {'FINISHED'}

def register():
bpy.utils.register_module(__name__)
bpy.types.Scene.test_vars = bpy.props.PointerProperty(type = test_vars)

def unregister():
bpy.utils.unregister_module(__name__)
bpy.utils.unregister_class(test_vars)
del bpy.types.Scene.test_vars

• Every time you update the prop, it calls the update method. Your update method calls an operator that updates the prop ... which calls the update method which calls the operator which calls the update method which calls the operator..... – batFINGER Aug 10 at 7:26
• Wow i'm an idiot, so obvious haha thank you – Way2Close Aug 10 at 22:48

In the execute method of the Test_Op class, you should access the property like this to prevent the update method from being called:
bpy.context.scene.test_vars["test_update_string"] = ""