how to instance and use the node

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By dango1

I have a node upon which I use a method. when I instance it in the main scene the method doesn’t pick up with the new node. The code looks like this:

onready var cube = preload(“res://theCUBE/MeshInstance.tscn”)
const SPEED = 0.005
var sw=0

func tmesh(mesh, sbody, labt, labs, labr):
etc etc etc

func _process(_delta):
tmesh($MeshInstance, $MeshInstance/StaticBody, $MeshInstance/Viewport/VBoxContainer/Labelt, $MeshInstance/Viewport/VBoxContainer/Labels, $MeshInstance/Viewport/VBoxContainer/Labelr)
if Input.is_joy_button_pressed(0,1):
var newm = cube.instance()
newm.translation = Vector3(0,0,0)

how can I call the method tmesh on the new instance? I tried taking all the children and subchildren of the new instance but I couldn’t make it work. Is there another option?