Access from second file to first

Hello i have 2 js files called "frstOne.js" and "secondOne.js"
 
in "frstOne" file i have
 
var frstOne= qc.defineBehaviour('qc.engine.secondOne', qc.Behaviour, function() {
}, {
});

frstOne.prototype.remind= function() {
    console.log(this.gameObject); //Or even return this.gameObject;
};
 
in file "secondOne" i have

var secondOne= qc.defineBehaviour('qc.engine.secondOne', qc.Behaviour, function() {
}, {
});

secondOne.prototype.awake= function() {
    
};
 
Question is how can i call remind function of firstOne from "secondOne.js"?
I mean i can call it but it does not outputs in console (this.gameObject) content not even returns.
 
The point is that i want to have full access to some js file functions and i want them to work just fine.
Has invited:

eric

Favor from: george828

You can get behaviour instance from node.getScript('abc.MyBehaviour'), for example if frstOne and secondOne are both added to the same node, then you can get frstOne object from this.gameObject.getScript('qc.engine.firstOne'), or secondOne object from this.gameObject.getScript('qc.engine.secondOne').

eric

Favor from: george828

Behaviour object can have node type variable that can be binded with other node, so you can get other node's behaviour by the reference node variable

george828

Favor from:

And what if they are added to different nodes?

george828

Favor from:

and how to access firstOnes function fron secondOne? 

eric

Favor from:

For example, in SecondOne's function
this.firstNodeRef.getScript('qc.engine.firstOne').remind()

george828

Favor from:

And will this work? for example:
var script = this.firstNodeRef.getScript('qc.engine.firstOne');

script.remind();

To reply to a question, please Login or registered