I am using the the CollectionProperty class to store a list of properties, so something like this:

class MyPropertyGroup(bpy.types.PropertyGroup):
    name = bpy.props.StringProperty(name="Property Name", default="Something")
    value = bpy.props.IntProperty(name="Property Name", default=22)

bpy.types.World.my_collection_prop = bpy.props.CollectionProperty(type=MyPropertyGroup)

Then in an Operator I am calling the add() method to create additional properties:

class MyOperator(bpy.types.Operator):
    # some irrelevant code here...

    def execute(self, context):
        my_prop = context.world.my_collection_prop.add()
        my_prop.name = "test"
        my_prop.value = 123

Now my problem is doing the opposite of add().

How do I go about removing an instance from a CollectionProperty?


2 Answers 2


As I was about to click the button to post this question, I realized maybe the CollectionProperty class extends/has the same methods as a dictionary or list. Anyway, with a little trial and error I found that it does (sort of).

To remove a single element:


To clear the whole collection:


I really don't understand how details like this get left out of the Blender API documentation.

  • $\begingroup$ And how to find the index of the element? $\endgroup$
    – mifth
    Commented Jan 18, 2015 at 10:16
  • $\begingroup$ @mifth to remove one element you have to have it's index. This is usually possible when you are using for example id obtained from UIList from gui - when user click on an item, you'll got it's id. Other than that you have to search thru the whole collection for specified elements, or just operate on numbers less than the total len of the collection. $\endgroup$
    – piotao
    Commented Apr 20, 2016 at 3:00
  • $\begingroup$ Related to this I just opened this: blender.stackexchange.com/questions/114190/… I also find it really annoying that the methods are not in the documentation. Are just missing them and they are burried in some place? $\endgroup$
    – IARI
    Commented Jul 18, 2018 at 8:46
  • $\begingroup$ 2.91 - it seems it doesn't anymore. $\endgroup$ Commented Feb 17, 2021 at 19:43

Use the CollectionProperty.find(name) to find the index of the item to remove. Then remove the item with remove(index) method. For example:

def remove_item(collection, item):

Then use like this:

remove_from_collection(context.world.my_collection, my_item)

You must log in to answer this question.

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