Cant call stop on audio before changing scene. PLEASE HELP!

When I try to call stop() on looping audio before changing scenes I get this error.

Attempt to call function ‘stop’ in base ‘null instance’ on a null instance.

here is the code I am using.

func _process(delta):
if VLifescore <= 0 :
$Music.stop()
get_tree().change_scene_to_file(“res://Gameover.tscn”)
else:
pass

what am I doing wrong.

What type of node is $Music? It is an Audiostream node?

It seems that _process is called before $Music is initialized. You better add a null check.

if VLifescore <= 0 and $Music != null:
    $Music.stop()

audiostreamplayer node

even after a null check music still equals null and nothing happens. The same scene continues playing and the music doesnt stop.

I did a null check after the already set code but in the same fuction and it worked.
Thanks.