How to solve attempt to call function error 'add_child' in base 'null instance' on null instance e

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GM12

Hello Godoters,
I have just started making a text game.I’m learning from one guy on youtube (here is the link https://www.youtube.com/watch?v=5gP1eOtR5Kg) and here is the code:
extends Control

const InputResponse = preload(“res://InputResponse.tscn”)

onready var history_rows = $“Background/MarginContainer/Rows/GameInfo/ScrollContainer/HistoryRow”

func _on_Input_text_entered(new_text: String) → void:
var input_response = InputResponse.instance()
history_rows.add_child(input_response)

I came to the point where I have to add a scroll bar into my game.
I have followed all his instructions but it doesn’t work.The engine keeps showing attempt to call function error ‘add_child’ in base ‘null instance’ on null instance.

:bust_in_silhouette: Reply From: kidscancode

“null instance” is what you get when you get_node() something that doesn’t exist. Since you’re calling add_child() on history_rows, that means that

$"Background/MarginContainer/Rows/GameInfo/ScrollContainer/HistoryRow"

is an invalid path.