create_collection

create_collection(name='NewCollection', parent=None)

Create a new Blender collection or retrieve an existing one.

Parameters

Name Type Description Default
name str The name of the collection to create or retrieve. Default is “NewCollection”. 'NewCollection'
parent Collection or str or None The parent collection to link the new collection to. If a string is provided, it will be used to find an existing collection by name. If None, the new collection will be linked to the scene’s root collection. Default is None. None

Returns

Name Type Description
Collection The created or retrieved Blender collection.

Raises

Name Type Description
KeyError If the parent collection name provided does not exist in bpy.data.collections.