Mesh Custom Properties editing through the Blender API

New mesh Custom Property can be created through the Blender python API by executing the following code:


  • object_name – name of the mesh
  • property_name – new custom property name
  • property_value – value of this new property

After executing this command, the new property will be created and will be available in the Properties window – Object panel – Custom Properties sub-panel.

Like any object custom properties, the created property has a number of parameters that can be accessed by clicking the Edit button. These parameters can also be changed through the API.

If you access the custom property directly by name, you can only change its value. However, the RNA interface allows you to access its additional parameters through the API.

The following code creates a new property with the name “myCustomProp” for the active (selected) mesh, sets property value to 11, and sets some values to its additional parameters:

Force redraw of the scene.areas in two last lines of the script needs to update the Custom Properties sub-panel and make the created property visible and available in Blender interface.

0 0 votes
Article Rating
Notify of

5 Comment
Oldest Most Voted
Inline Feedbacks
View all comments
ed hernandez
ed hernandez
2 years ago

Dude, it seems like this code could really help me, thanks in advance. However, It doesn´t work on blender 3.0. Could you tell me how to get it working? thanks again

2 years ago
Reply to  ed hernandez

Blender 3.0 is still beta now. Something may not work properly. I don’t read about removing this part of API in 3.0 so I think you can report a bug to developers.

ed hernandez
ed hernandez
2 years ago
Reply to  Nikita

Thanks for your answer, I think they actually say something about it in

down the title: IDProperty UI Data API
but I’m not sure about what does it mean, I’m really not good at coding.

I’m specially interested in the method as_dict but have no idea how to use it to get the max value for a custom property.

I’m trying:

scn =[“Scene”]
scn[‘myCustomProp’] = 11
dict = scn.id_properties_ui_as_dict(‘myCustomProp’)

but it doesn’t work

could you please give me any clue?

thanks again

ed hernandez
ed hernandez
2 years ago
Reply to  Nikita

Thanks, Nikita, I’ll check the example 🙂