# NLA Editor: select specific NLA track in python

Is there an easy way to select a specific NLA Track with a python script?

## 1 Answer

Set the NLATrack.select property to true.

Sample script, selects all tracks, on context object, which have a name beginning with "Nla" The zeroth position track is set to active.

import bpy
from bpy import context

ob = context.object
ad = ob.animation_data
if ad:
for i, track in enumerate(ad.nla_tracks):
# select all whose name starts with "Nla"
track.select = track.name.startswith("Nla")
# make active track if in pos 0
if track.select and not i:
ad.nla_tracks.active = track

• It gives me an error in the console "AttributeError: bpy_struct: attribute "active" from "NlaTrack" is read-only" regarding line 11. The whole reason I'm doing this is to separate different NLA tracks into separate objects, if you know an easier way than duplicating, removing animations, then re-adding, please let me know. – VirtualTurtle Jan 9 '18 at 19:38
• Whoops, fixed it. – batFINGER Jan 10 '18 at 1:13