Collection Operators

bpy.ops.collection.create(name="Collection")

Create an object collection from selected objects

Parameters:name (string, (optional, never None)) – Name, Name of the new collection
bpy.ops.collection.objects_add_active(collection='')

Add the object to an object collection that contains the active object

Parameters:collection (enum in [], (optional)) – Collection, The collection to add other selected objects to
bpy.ops.collection.objects_remove(collection='')

Remove selected objects from a collection

Parameters:collection (enum in [], (optional)) – Collection, The collection to remove this object from
bpy.ops.collection.objects_remove_active(collection='')

Remove the object from an object collection that contains the active object

Parameters:collection (enum in [], (optional)) – Collection, The collection to remove other selected objects from
bpy.ops.collection.objects_remove_all()

Remove selected objects from all collections not used in a scene