Hello, is it possible to trigger “play” and “stop” using python scripts in the script editor ? Thanks!

Hello, is it possible to trigger “play” and “stop” using python scripts in the script editor ? Thanks!
The following is how you can play and stop using python.
from omni.timeline import get_timeline_interface
timeline = get_timeline_interface()
timeline.play()
timeline.stop()
It works! Thank you!