Restart Scene by EventListener

I want to use GDevelop Games embedded in another Website with some extended Features. Therefore I want to control some functions via external Events. Basically Pause/Resume/Restart.

I created an extension to handle the Events:

// Add Eventlistener for pause
window.addEventListener("pspause", function(){
    //add events for pause
    runtimeScene._timeManager.setTimeScale(0);
}); 
// Add Eventlistener for resume
window.addEventListener("psresume", function(){
    //add events for resume
    runtimeScene._timeManager.setTimeScale(1);
}); 
// Add Eventlistener for Restart
window.addEventListener("psrestart", function(event){
    //add events for restart
    gdjs.evtTools.runtimeScene.replaceScene(runtimeScene,runtimeScene._name,true);
});

The first two work as expected, pausing the game and resuming it on the respective Events. But the line “gdjs.evtTools.runtimeScene.replaceScene(runtimeScene,runtimeScene._name,true);” simply does not work. It doesnt matter if i use the variable or a string containing the scene name.

If the line is called outside the Eventlistener (in the scene or in an extension) it works, but that does not really suit my needs. Can someone please help or suggest a workaround?
Many thanks.