How to update player data from a resource file after loading the level in godot engine?

Loading Player Data

In Godot engine, the player data can be updated from a resource file using the following method:

               var data_file = File.new()               # to open the file               data_file.open("user://player_data.gd", File.READ)                              # to get the data file content               var data = data_file.get_as_text()                              # to close the file               data_file.close()               # loading the content as a resource               var player_data = load("res://player_data.gd").new()                              # updating the player data               player_data.health = data['health']               player_data.position = Vector2(data['x'], data['y'])               player_data.lives = data['lives']               

This is a basic way of updating player data from a resource file after loading the level in godot engine.