How to find persistent in new scene?

How to find persistent in new scene?
0.0 0

#1

Here is my code:

In scene 1 with a button that sends me to scene 2, and a node with the following code. The node is placed at the root of scene.
cc.Class({
extends: cc.Component,

    onLoad () {
        cc.game.addPersistRootNode(this.node);
    },

    start () {
        cc.log('toolbox start');
    },

    saySomething : function(){
        cc.log('say what');
    }
});

In scene 2, a node with this code, this node is put in root of scene.
cc.Class({
extends: cc.Component,

    start () {
     var toolbox =  cc.find("Toolbox");

    this.scheduleOnce(function() {
            this.ToolBoxFound();
    }, 2);

    },

    ToolBoxFound : function(){
        cc.log('Find tool box');
        this.toolbox.getComponent(cc.Node).getComponent('Toolbox').saySomething();
        }
    });

I’m getting this error:
Uncaught TypeError: Cannot read property ‘getComponent’ of undefined


#2

Fixed it like this in function ToolBoxFound:

ToolBoxFound : function(){
cc.log(‘Find tool box’);
this.toolbox.getComponent(‘Toolbox’).saySomething(‘123’);
if(this.toolbox){
cc.log(‘toolbox is not null’);
let tb = this.toolbox.getComponent(‘Toolbox’);
tb.saySomething(‘456’);
}

    }