*Property
functions in bpy.props
module are what we use to instantiate the property. Classes with the same name in bpy.types
contains structure related to the property, accessible at runtime.
For example, in the snippet below I use bpy.props.IntProperty
function to add a custom property to a scene object, say, as bpy.types.Scene.int_prop
. Even though scene.int_prop
is a Python integer, I can still access the property's structure as scene.rna_type.properties['int_prop']
, and the type will be bpy.types.IntProperty
.:
import bpy
bpy.types.Scene.int_prop = bpy.props.IntProperty(default=9)
# > 9
print(bpy.context.scene.int_prop)
# > <class 'int'>
print(type(bpy.context.scene.int_prop))
# > <class 'bpy.types.IntProperty'>
print(type(bpy.context.scene.rna_type.properties['int_prop']))
del bpy.types.Scene.int_prop