Bpy.ops.Outliner.show_active() from view3d context?

You need to supply ‘area’ and ‘region’ context keys to override the operator from a different area.

import bpy
context = bpy.context


def show_active(context):
    override = None

    for area in context.screen.areas:
        if 'OUTLINER' in area.type:
            for region in area.regions:
                if 'WINDOW' in region.type:
                    override = {'area': area, 'region': region}
                    break
            break
    if override is not None:
        bpy.ops.outliner.show_active(override)


if '__main__' in __name__:
    show_active(context)

You can turn this into a hotkey by saving to a py file and adding it using the blender operator script.python_file_run in the hotkey editor.

2 Likes