File is not being declared in dialogue player (Rafa Fiedo Godot Dialogue Tutorial)

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

@export var dialogue_file:JSON

var dialogues = []
var current_dialogue_id = 0

func _ready():
func play():
	dialogues = load_dialogue()
	current_dialogue_id = -1
func _input(event):
	if event.is_action_pressed("Interact"):
func next_line():
		current_dialogue_id += 1
		$NinePatchRect/Name.text = dialogues[current_dialogue_id]["name"]
		$NinePatchRect/Text.text = dialogues[current_dialogue_id]["text"]
func load_dialogue():
	var file =
	if file.file_exists(dialogue_file):
		return parse_json(file.get_as_text())

Error: Line 28:Identifier “File” not declared in the current scope.
Line 31:Function “parse_json()” not found in base self.

This Godot v3 code doesn’t work in Godot 4.0.3
Thanks in advance…

:bust_in_silhouette: Reply From: GameSchool


In godot 4 we no longer use file, we use FileAccess