It depends on how things are setup, but one technique I’ve seen use in lieu of code for a single-time action that is something on the timeline is to use the ‘continue timeline’ action with the option to not restart the timeline. If you have some timeline action at the beginning of the timeline, it will get triggered once on your action. Then, any other calls will be ignored, because the playhead is going to be at the end.
It gets a little more complicated to use this technique if you are using different scenes, but a global state could be made in a persistent symbol, with the timeline existing inside. The way to communicate to this is through Custom Behaviors.
A better recommendation would entail getting a look at your document… and after all this ot might be that the code approach is easier !