# How do you remove a uv map by index with python?

Can delete a UV Map / Texture, via

bpy.ops.mesh.uv_texture_remove()


But how can I delete a UV Map by it's Index?

## 1 Answer

Set the active index,

Similarly to materials and other lists where the active and active index can be set.

Example in python console. The 3rd UV map is active

>>> C.object.data.uv_layers.active_index
2


Change instead to second (index 1)

>>> C.object.data.uv_layers.active_index = 1


Operator removes the active UV map

>>> bpy.ops.mesh.uv_texture_remove()
{'FINISHED'}


See also How to find and delete extra UV layers on many objects? : can remove directly using the remove API method.

>>> C.object.data.uv_layers.remove(C.object.data.uv_layers[1])

• Thank you so much!! Jun 9 at 15:05