1
$\begingroup$

I want to use for example bpy.ops.outliner.collection_isolate on one of collections in my scene How can I do that?

$\endgroup$

1 Answer 1

2
$\begingroup$

Do with active collection

import bpy

# get first outliner, Make sure it has outliner in the workspace or you will get an error
for area in bpy.context.screen.areas:
    if area.type == 'OUTLINER':
        break

with bpy.context.temp_override(area=area):
    bpy.ops.outliner.collection_isolate()
$\endgroup$
2
  • $\begingroup$ Will it work without UI loaded? (from OS console) $\endgroup$
    – Bicukow
    Oct 29, 2023 at 19:50
  • $\begingroup$ I think Probably not. $\endgroup$
    – X Y
    Oct 29, 2023 at 19:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .