How to make it so the game waits on player input for a dialog system in Godot?

So i have most system set up im just at loss on make it so that the player has to click through the dialog. Currently all the dialog is stored in text files that are read into dictionary's like so.

var dic = {}

func test():
var index = 1
popup_centered(Vector2(0,2000))
var line = dic[str(index)]
\$Text.set_text(line)

dic = {}
var file = File.new()
file.open(filepath, 1)
var index = 1
while not file.eof_reached():
var line = file.get_line()
print("the line:")
print(line)
dic[str(index)] = line
index += 1
file.close()
print(dic)
test()


Where the test function is like i said above i want the code to wait for the players input and print the next line in the dictionary and then close when the dictionary is empty. Being new to Godot i dont know if there is a simple way to do this. Any help is appreciated and thank you in advance.

Also aside, i know there are a lot of plug-ins for Godot that can handle dialog if i download them, but i want to build this myself so i can learn, so please don't just say use a plug in.

func _input(event):