I guess you’re calling that function on ready? In that case, that would explain the issue, as adding children to scene root on ready doesn’t work as you would expect (I believe this is due to the tree being busy setting up stuff, but I’ll let anyone give a better explanation as I’m not an expert on that topic ).
If you add the sprite to the Node2D itself, like this:
I tried your code, still no sprite shown when run?
Completely new to Godot Engine, but have some JavaScript programming knowledge.
Any ideas about what I am doing wrong?
The script is attached to the Node2D in the scene.