How can I access classes created in one script

GuideManager.prototype.randomMethod= function(dt) {
   
};

is there a way to call randomMethod from a different JS file. I tried this.app.scripts.get("guideManager").randomMethod() but did not work

Hi @Saurav_das1!

Unfortunately no one answered your question. Below is the only way I know, so maybe it can help you.

entity.script.guideManager.randomMethod();
2 Likes

Hey @Saurav_das1, in addition to what @Albertos mentioned, you can also create a global file that contains functions and call them anywhere.

file A

let randomMethod = function(){
   console.log('called!')
}

and in file B

randomMethod() // 'called!'

You’ll nee to make sure that A is loaded before B in this instance as per these docs

3 Likes