Use python to run toolbar function

Hello,I want to know how can I use python python to run toolbar function in the 3D slicer.For example,I want to use python to run the next frame function automactically.I refer to the ScriptRepository examples and I try it as followed code.But after I run this code there is nothing happen in the 3D slicer.Where is wrong?Where can I learn more about this?

playWidget = slicer.qMRMLSequenceBrowserPlayWidget()
playWidget.onVcrNext()