scripting in blender - selecting a collection in blender python,

hi, I am looking for a way to select a specific collection and manipulate it, i.e. not only read-only. I'm using blender 2.81a - I'm new to scripting and have benn trying things out for three days, but it all comes to nothing. I'd be very grateful for a way

  • Wayne Dixon replied

    You can try two things.


    bpy.data.collections['YOUR_COLLECTION_NAME']

    or

    bpy.context.scene.collection.children[0] #or the index of your collection (that is the first child collection of the master scene)


    I would mess around in the python console with autocomplete to figure out the way to do what I wanted to do.

    eg - to change the name of your collection... (D is a shortcut for bpy.data in the console)

    D.collections['Collection'].name = 'Test'


    Good luck