Is there a way to access a collection's name other than through bpy.context so it can be renamed?


Collections are ID objects

In blender any ID object is stored in bpy.data Objects in bpy.data.objects meshes in bpy.data.meshes collections in bpy.data.collections etc etc

To rename a collection named "Bob" to "Frank"

import bpy

col = bpy.data.collections.get("Bob")
if col:
    col.name = "Frank"

Note if there is already a collection named "Frank" then numbers are appended "Frank.001"... as per unique naming convention.


How to rename objects with python?

  • $\begingroup$ Thank you, batFINGER. Just what I was looking for. $\endgroup$
    – no-one
    Aug 21 '20 at 17:59

This site is temporarily in read only mode and not accepting new answers.

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