No, I mean you don't actually have to query anything.
1. Create a value or condition.
2. Create 2 scene objects.
3. Create an animation per scene object & set that animation as the default animation for linked scene object via the properties tab.
4. Again in the properties tab, link the value or condition to both of the scene objects.
You should now be able to able to toggle which animation is shown by changing the value/condition. & because you linked them as default animations they will start playing as soon as you edit the value or condition & will also play on scene load too.