Why am I not seeing the trasformation takes place in the viewport? please help explain what I am missing?
def transform1(objs, location=(0, 0, 0), rotation=(0, 0, 0), scale=(1, 1, 1), mode='XYZ'):
# Ensure we're operating in object mode
bpy.ops.object.mode_set(mode='OBJECT')
for obj in objs:
# Set the location, rotation, and scale of each object
obj.location = location
obj.rotation_euler = Euler((rotation[0], rotation[1], rotation[2]), mode)
obj.scale = scale
# Make the object the active one
bpy.context.view_layer.objects.active = obj
obj.select_set(True)
# Apply the transformations to the object data
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
# Deselect the object
obj.select_set(False)
bpy.context.view_layer.update()
```