# Iterate through all objects in the current scene for obj in bpy.context.scene.objects: # Check if the object is a mesh if obj.type == 'MESH': # Access the object's data (the mesh) mesh = obj.data # Check if "uv_0" exists and remove it uv_0 = mesh.uv_layers.get("uv_0") if uv_0 is not None: mesh.uv_layers.remove(uv_0) print(f'Removed "uv_0" from {obj.name}') # Check if "uv_1" exists uv_1 = mesh.uv_layers.get("uv_1") if uv_1 is not None: # Set "uv_1" as the active UV map mesh.uv_layers.active = uv_1 print(f'Set "uv_1" as active for {obj.name}')