Associating actions with armatures

I’m writing an export script in which armatures can have unlimited numbers of actions, each of which needs to be exported. My problem is telling which actions go with which armature. Just dumping them all out to the same place would confuse users working on multiple models in the same blend file.

The NLA editor seems like a built-in solution to this, but I’m having trouble writing scripts for it: I’ve a Properties panel, and it can’t run any NLA ops because it’s in the wrong context!

Are there any non-Operator ways to create and manipulate NLA tracks? Or can a panel’s context be changed? Or maybe there is another way of grouping actions that I’ve not discovered yet?

Before using NLA, I had tried creating a new collection property for armatures containing actions, but that ended up a huge mess and didn’t really work anyway…

I seek a solution for many mounth but i find nothing, i don’t understand why we can’t use some function for create an nla track, the animation programming would be so easy