How can i store a array/list of Pointer Properties?!
I want every pointer to point to a object and get a specific pointer with an index or key.

import bpy

class customPropertiesGroup(bpy.types.PropertyGroup):
    objects = bpy.props.PointerProperty(type=bpy.types.Object)    

bpy.types.Object.customList = bpy.props.CollectionProperty(type=customPropertiesGroup)

ob = bpy.context.active_object.customList.add().name = 'ob_01'
ob = bpy.context.selected_objects[1].copy()

is how can i access ob_01 and does ob_01 actually store a copy of selected object [1]?

  • $\begingroup$ Python does not use pointers the way C does. qa.geeksforgeeks.org/1540/qa.geeksforgeeks.org/1540/… $\endgroup$ Commented Mar 22, 2019 at 14:08
  • $\begingroup$ @JustinHelps sure but im talking about docs.blender.org/api/blender2.8/bpy.types.PointerProperty.html they exist and i want a array of these props that is unique to every object when i make a array of the pointerprops and store them in a object they are shared between all objects $\endgroup$
    – Syler
    Commented Mar 22, 2019 at 14:16
  • $\begingroup$ Okay, I'm not exactly sure what you're trying to do. Could you add some code that you would think should work but doesn't? $\endgroup$ Commented Mar 22, 2019 at 16:48
  • $\begingroup$ @JustinHelps my current workaround is that i create new objects and just dont add them to the scene/renderlayer/collection so that they remain hidden, they all have a index prop and when i want to access one object i loop trough all objects that have a pointer prop if that equals to the active object i check their index props if that index prop is what i want then i have my reference to the object that i want to access having a single array/list variable would be much cleaner but if thats not possible i will just use my messy system $\endgroup$
    – Syler
    Commented Mar 22, 2019 at 17:21

2 Answers 2


Can add methods to the propertygroup definition

Something that is very handy IMO is the ability to add methods to the property group.

Here I've added copy to make a copy of itself to the collection, and add to add an object to the collection. In both cases the object name is used as the collection item name.

Remember that 2.8 uses annotations for properties.

import bpy

class ObjectCopy(bpy.types.PropertyGroup):
    object: bpy.props.PointerProperty(type=bpy.types.Object)    

    def copy(self):
        self.object = self.id_data.copy()
        self.name = self.object.name
        return self.object

    def add(self, ob):
        self.object = ob
        self.name = ob.name
        return self.object

def register():
    bpy.types.Object.copies = bpy.props.CollectionProperty(type=ObjectCopy)

def unregister():
if __name__ == "__main__":

Some testing in the python console.

>>> C.object.copies.clear()
>>> for o in C.selected_objects:
...     C.object.copies.add().add(o)

>>> C.object.copies.add().copy()

>>> C.object.copies['Cube'].object
  • $\begingroup$ nice thank you is there a way to store only bpy.context.active_object.data or modifiers? $\endgroup$
    – Syler
    Commented Mar 25, 2019 at 17:16
  • $\begingroup$ For data could add pointers for each case, eg mesh, armature. Possibly easiest to do both on an object level. Save a dummy object, and hence it's data and any added modifiers. $\endgroup$
    – batFINGER
    Commented Mar 26, 2019 at 8:17

You are actually pretty close.

class CustomProp(bpy.types.PropertyGroup):
    id: bpy.props.IntProperty()
    object: bpy.props.PointerProperty(

bpy.types.Scene.custom = bpy.props.CollectionProperty(type=CustomProp)

Adding objects:

scn = bpy.context.scene
item = scn.custom.add()
item.id = len(scn.custom)
item.object = bpy.data.objects.new(name="My Object", object_data=C.object.data)
item.name = item.object.name
  • 5
    $\begingroup$ i get this error: TypeError: bpy_struct.__new__(type): expected a single argument, im using 2.80 0bbff8a71138 $\endgroup$
    – Syler
    Commented Mar 25, 2019 at 15:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .