I have created a custom property and want to set a minimum and a maximum for it through python; I tried to make it using bpy.ops.wm.properties_edit but it didn't work,so how can I edit a custom property with Python?

Here is how I defined my property:

bpy.data.objects[name of my object]['name of my property'] = 2 
  • $\begingroup$ Can you show the code you used to create the property? Or is this a property you created via the UI? $\endgroup$ Nov 29, 2014 at 17:00
  • $\begingroup$ @RayMairlot bpy.data.objects[name of my object]['name of my property'] = 2 $\endgroup$
    – Omar Emara
    Nov 29, 2014 at 17:47

2 Answers 2


This is what you do to set min to 0 and max to 500, the soft_min and soft_max is optional and is only for dragging in gui:

ob = bpy.data.objects[name_of_my_object]

# this is a dictionary containing IDprops settings
# this creates it and erases it:
ob["_RNA_UI"] = {}

# add properties settings like this:
ob["_RNA_UI"]['name_of_my_property'] = {"min":0.0,
                                        "max": 500.0,

BLender 3.1 method.

lod_prop = "LOD"
control_object[lod_prop] = 1
id_props = control_object.id_properties_ui(lod_prop)
control_object.property_overridable_library_set('["LOD"]', True)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.