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

About the Dictionary, first i tested this to get the bullet_pool in a variable inside the bullet script

@onready var test= get_tree().get_first_node_in_group(“test_group”)

and then tried puting a class_name on the bullet maneger node to use it remotely

bulletManeger.new().bullet_pool[“ball_M”].erase(self)

and then i used it as an autoload/singleton node

BulletManeger.bullet_pool[“ball_M”].erase(self)

all of them worked properly, so i could not understand what is the problem.

Here’s how i did:

extends Node2D

var pool = []

var bullet_pool : Dictionary = {
	"ball_M": [1],
	"knife": [],
}
func _ready():
	for i in 5:
		var objShot = load("res://....tscn").instantiate()
		pool.append(objShot)
		get_tree().get_root().call_deferred("add_child", objShot)
		bullet_pool["ball_M"].append(pool[i])
		pool[i].active()
func active():
	await self.ready
	await(get_tree().create_timer(lifespan).timeout)
	deactivate()

func deactivate():
	BulletManager.bullet_pool["ball_M"].erase(self)
	print(BulletManager.bullet_pool["ball_M"])
	queue_free()

sorry for that :confused: , i found that other person that got the same issue, if it helps