I am still quite new to Python scripting in Blender. Right now, I am reading through the Quickstart in the API documentation.
In an example, where a custom property is added to a collection, a new collection is created with the following line of code
collection = bpy.data.collections.new("MyTestCollection")
I read in the documentation for collection operators that you can also create a collection with
bpy.ops.collection.create("MyTestCollection") collection = bpy.data.collections["MyTestCollection"]
However, in both cases, the result is not visible in the outliner. (Is that bad?)
Could anybody please explain whether both ways of creating a collection are equivalent?
If not, in what cases should we use one or another ?