blender 2.7 python setting active object code example Example: blender 2.8 python set active object context.view_layer.objects.active = ob