#make sure you are on version 3.0.1! import bpy def set_active_object(obj: bpy.types.Object) -> None: bpy.context.view_layer.objects.active = obj