Automatically rename animation tracks and lock them

Hello everybody

I would need a python script that automatically rename all the animation tracks applied on objects in a Blender file (for example applying the name “Scale” to all of them), and lock them.
See screenshot attached.
Does anyone know how to do it?

Many thanks in advance!

Should be something like this: (tested in Blender 3.1)

import bpy

obj_tracks = [o.animation_data.nla_tracks for o in bpy.data.objects if o.animation_data and o.animation_data.nla_tracks]


for tracks in obj_tracks:
    # in case multiple tracks for an object
    for track in tracks:
        track.name = 'Scale'
        track.lock = True
2 Likes

Thank you! Perfectly working!
You are a hero :grinning: