# Is There a Way to Change a Prop with an Update Def without Calling the Update Def?

Is there a way to change a prop with an update def without calling the update def?

def update_prop(self, context):
print ("update")
if self.variable > 10:
self.variable  = 10 #10 is a variable that changes in my code
#i want to set the prop without recalling the update
else:
print("else")

class Props(bpy.types.PropertyGroup):

bpy.types.Object.variable  = bpy.props.IntProperty(
name="variable",
default=0,
min=0,
update=update_prop,

• Please make the question more clear and concise. Mar 22 '19 at 19:56
• Could you please put a little more effort into your questions? Mar 22 '19 at 20:05
• @metaphor_set better ? Mar 22 '19 at 20:27
• A lot better, actually. Mar 22 '19 at 20:41

In the example, simply setting a max will do this for us

import bpy

def update_prop(self, context):
print ("update")
print(self.variable)

bpy.types.Object.variable  = bpy.props.IntProperty(
name="variable",
default=0,
min=0,
max=10,
update=update_prop)


In python console

>>> C.object.variable = 22
update
10

>>> C.object.variable
10


If you wish to set a value and not fire an update, set the id property. A property defined via bpy.props for example ob.prop is stored as ob["prop"] once set to non default.

May be better to use a getter / setter method(s) Internal "get/set" function of property?

def update_prop(self, context):
print ("update")
self["variable"] = 4
print(self.variable)

>>> C.object.variable = 22
update
4

>>> C.object.variable
4


Note this has been answered recenlty, couldn't find that one