I can create a custom property for my object by pressing "Add" on the "Custom Properties" tab. I would like to do this via script. I tried this way:

bpy.ops.wm.properties_edit(data_path="object", property="MyProperty", value="0", min=0, max=1, use_soft_limits=False, soft_min=0, soft_max=1, description="")

But I get a compiler error RuntimeError: Error: Direct execution not supported.

Is it possible to do this via script?

I'm using version 2.79. The purpose of the custom property is to use it to drive other properties.


You just do:

import bpy 

bpy.context.object.data["some_property"] = "Some value"
  • $\begingroup$ Thanks! Do you know how to edit the min/max values via script? When I add a property it shows in the UI that the min/max value is 0.0/1.0, but it goes way past one when using the slider to edit the property value. $\endgroup$ Oct 22 '19 at 7:16
  • 1
    $\begingroup$ Nvm, found the answer. If somebody else is wondering blender.stackexchange.com/questions/143975/… $\endgroup$ Oct 22 '19 at 7:39

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.