Spawning a Scene as a Child of a node

Godot Version

4.4.1

Question

Hello, I am making a Tower Defense game with some friends for a project, I’m curious of there is a way to spawn an object made as a scene (more specifically an enemy) as a child of a Path2D node. Keep in mind the enemy is a Path2DFollow node that should be attached to a Path2D.

I didn’t write too much, I just have variables in so far.

#enemy call from scene
@onready var enemy = preload("res://Scenes/enemy.tscn") 

var enemyCount = 0 #counts how many enemies are on screen

I’m not asking to “do this for me”, I’m mostly asking for suggestions on how I should approach it.

You can get a reference to your Path2D node in code, then simply add it as a child of that node with the add_child(yourInstance) function!
If it’s a packed scene, you can load it with a ResourceLoader.

find the “add child node” and click the chain next to it and select your scene.