Manipulating game data with external javascript

Hi Guys,
I’m new with GDevelop and I’m developing a project that I need to use external javascript code to change game data (scene variables, object variables, …)
The way I found to do this is making “runtimeScene” visible as a global variable

var rt;
function setRuntimeScene(runtimeScene){
      rt = runtimeScene;   

then calling “setRuntimeScene(runtimeScene)” from GDevelop javascript code event.
My question is if is there a more ‘elegant’ way to do the same?

Thank you all

This is enough

window.scene = runtimeScene; variables = scene.getVariables();

You can see this example :

thank you!