Child having, Nonexistent function, error

Godot V4.1

The child of something I want to clone is having troubles accessing functions of the parent.

when I try to run my code, I get [Invalid call. Nonexistent function ‘initialize_life’ in base ‘Node2D’.]

Here is the part of the code responsible for cloning

	food = roundf(food / 2)
	var thing_scene = preload("res://Thing.tscn")
	var parent_position = position

	# Clone Variable prep
	var thing = thing_scene.instantiate()
	thing.position = parent_position + Vector2(randf_range(-50, 50), randf_range(-50, 50))
	get_parent().add_child(thing)
	thing.initialize_life(DNA.duplicate(), food)  # Call initialize_life explicitly

and here is the function it’s having troubles running.

func initialize_life(DNA, food):

# I left out defining variables because it seems irrelevant 

	
	var RNA = [DNA, speed, size, storage, SplitPower, hunger, MutationRate, neurons]
	if is_inside_tree():
		Pause(RNA, food)
	else:
		call_deferred("Pause", RNA, food)

The pause func just leds to a get_tree().create_timer(1).timeout.

You have made no reference to thing on the scene tree.

Adding it doesn’t create a reference path to it.

You need to use something like get_children() to identify the child node and get_node_or_null() to gain access to it

I’m not sure what that would like like, or how it adds the child to the tree. I already have a direct reference to the instantiated node when I create it.

You made a reference to the instance, not to the child…these two things are not equivalent.

get_node(“…/thing”).initialize_life(DNA, food)

I don’t know what’s going on with the dots…that should be two dots, as in parent node…

I think you are leaving out too much to figure out what is going on.
If you aren’t getting an error on:

thing.position = parent_position...

then for sure thing is not null.
Maybe double check that you actually have the script attached to the top level node of Thing.tscn
If that isn’t it then post the scene tree for Thing.tscn as well as for where you are calling the troubled code from.