Get_tree() returns null, but object is in the scene tree

hmmm, so, the problem is probably in calling the “activate()” function while the node has not been fully loaded (because get_tree() will always return the tree in which the node is inserted, and will return an error if the node is not inside the tree), so much so that if you call the same function in _process(): it will work normally.

I did this changes in my test project and its still working properly

func _ready():
	for i in 5:
		var objShot = load("res://....tscn").instantiate()
		pool.append(objShot)
		get_tree().get_root().call_deferred("add_child", objShot)
	    await(pool[i].ready) 
        # or: await pool[i].is_inside_tree()
		pool[i].active()
func active():
	await(get_tree().create_timer(lifespan).timeout)
	print("working?")
	deactivate()

func deactivate():
	print("help_test")
	queue_free()
	if self.is_queued_for_deletion() == true:
		print("im queued")

My assumption is that you should put the “await bullet.ready” right after you create the nodes (has i did in my for loop), or add a condition in CreateShotA1. I suppose this should, work:

func CreateShotA1(...):
	var objShot = get_available_bullet(bullet_type)

	if not objShot == null && objShot.is_inside_tree() == true:
...

Here’s some stuff that i found about it, maybe it can help you: https://www.reddit.com/r/godot/comments/18ttaau/i_keep_getting_an_error_that_data_tree_is_null/
Get_tree().reload_current_scene() crashes game
Using SceneTree — Godot Engine (stable) documentation in English
Using SceneTree — Godot Engine (stable) documentation in English

(It’s a common problem in godot 4 apparently), if nothing ended up working, use a instantiated Timer instead, atleast until you figure out what is the solving key.

About the dictonary problem, i’ll see it now!