I can find only active collection with bpy.context.collection
, there should be bpy.context.selected_collections
similar to bpy.context.selected_objects
.
How to get a list of selected collections?
This answer is based on https://blender.stackexchange.com/a/293231/123423
import bpy
from bpy import context
def selected_collections(context):
for area in context.screen.areas:
if area.type == 'OUTLINER':
with context.temp_override(area=area):
return [item for item in context.selected_ids if isinstance(item, bpy.types.Collection)]
print(selected_collections(context))
bpy.context.selected_ids
different frombpy.context.selected_objects
? $\endgroup$