Omniverse replicator

I want to call a function on each frame when i run a replicator.
I am writing this in the script editor as a test:

import omni.replicator.core as rep

with rep.new_layer ():
    with rep.trigger.on_frame (10):
           print (1)

rep.orchestrator.run ()

My desired output is to see 1 10 times in the console, so that i can replace the print statement with my function.
However, i am getting 1 once and then a messages saying “resetting the animation timeline”