# How to get the active strips in the NLA editor from Python?

Is it possible to get the active strips in the NLA Editor with Python, in order to run a function on them?

You can get the active NLA track, but the strips array has no property .active in the Python API. It's not exposed, but the active strip is known in the C code (note that the Active Strip panel is hardcoded).

All you can do with Python is to get all selected strips:

try:
selected_strips = [strip for strip in bpy.context.object.animation_data.nla_tracks.active.strips if strip.select]
except AttributeError:
selected_strips = []

• Thank you for your answer, it is as I thought when I looked the source. Too bad for my addon. – rools May 12 '14 at 12:18
import bpy

for i in bpy.data.objects:
for j in i.animation_data.nla_tracks.values():
for k in j.strips.values():
if k.active:
print(k)

• Your code seems to give the selected strips, not the active strips. – rools Feb 28 '18 at 8:37
• Yes. I use select instead active – user41149 Mar 1 '18 at 9:46