How can I add a collection using Python?
BlendDataCollections.new(name)
Recommend use the python console to figure out:
&gt;&gt;&gt; D.collections.new(
new()
BlendDataCollections.new(name)
Add a new collection to the main database
...

&gt;&gt;&gt; my_coll = D.collections.new(&quot;MyCollection&quot;)
&gt;&gt;&gt; C.scene.collection.children.link(my_coll)

Demo on how to create a new collection and add the default cube using CollectionObjects.link(object):
import bpy

# New Collection
my_coll = bpy.data.collections.new(&quot;MyCollection&quot;)

# Add collection to scene collection
bpy.context.scene.collection.children.link(my_coll)

# Get cube object
obj = bpy.context.scene.objects.get(&quot;Cube&quot;)

if obj:
    # Link the cube 
    my_coll.objects.link(obj)