Simple script to change UV layer on all scene objects

Hey there,

I’m new to Blender’s scripting and have been trying to make a simple little script that simply changes the UV layer on all my scene objects at the same time. For example changing from the “UVMap” to “Lightmap” layer.

I’ve tried the following but it only seems to change the active object and ignores all other objects:

import bpy

for o in bpy.context.scene.objects:
bpy.context.object.data.uv_textures[‘Lightmap’].active = True

Any help would be great, thanks.

James.

I would have to test in blender ,but try replacing bpy.context.object with o.

Perfect, that worked :wink: Thanks.