Hello there friends.
I have an object that is shooting (instancing) projectile objects and its working fine.
I am trying to use remove_child() to free any projectile that is instanced after the enemy dies so the projectile doesn't just vanish (the projectile can free itself just fine, made sure of this first). A bool flips when a projectile is fired and I've tried checking this but the bullet still disappears after the enemy is freed. Not getting any errors in the debugger either. I should note that the "EnemyBullet" is instanced from the enemy so hence the "if" to check if it exists before running.

Code seems simple enough. What am I missing?

func _exit_tree():
	var _orphan = get_node("EnemyBullet")
	if _orphan:
		remove_child(_orphan)

remove_child takes the object out of the scene tree, so it effectively only exists in memory. You can bring it back from this limbo state with add child, but otherwise you cannot see it, it will not be updated, etc. In general you should not have spawned objects as children of the player or enemies. They should be on another layer in the world space (same position system as the level) like on another Node2D. That way if the enemy dies they are independent.