Starting and Stopping an Animation from Python Script (Standalone Workflow)

Hello - I am working generating Synthetic data from an animation I have recorded using the Stage Recorder Extension. I have successfully saved the animation as a usd and can play it by pressing the play button. However after the animation is finished the simulation doesn’t automatically stop. I am trying to use this animation to generate a synthetic dataset by following the scene_based_sdg.py example however I cannot find out how to do this with a pre-generated animation. In particular I don’t know how to set the start and stop conditions in the case of an animation. How would I go about modifying the snippet below for my approach?