I had a problem with my inventory GUI when I try to load the player data with Godot 4.2

Godot Version

Godot 4.2


Hello, I have a question with respect to: how can I synchronize the load system with my inventory GUI? I try to create this functionality all these days, can someone explain me how I can create this functionality in my game, please? Thank you very much for reading this topic!

The code of my inventory system:

extends Node

var max_slots: int = 9
var inventory = []

func add_item_to_inventory(item: ItemWeapon):
	if inventory.size() < max_slots:
		printerr("The inventory is full!")
func create_item(weapon_name: String, damage: int, icon: Texture2D, amount: int):
	var new_weapon = ItemWeapon.new()
	new_weapon.name = weapon_name
	new_weapon.damage = damage
	new_weapon.icon = icon
	new_weapon.amount = amount

The code of my save and load system (there you will find the save and load inventory funcionality):

extends Node

var user_filename = "user://save_game.dat"

func save_data():
	var player_data = {
		"coins": Global.coins,
		"lifes": Global.health_rabbit,
		"levels_gained": Global.levels_gained,
		"inventory": Inventory.inventory
	var save_file = FileAccess.open(user_filename, FileAccess.WRITE)
	save_file = null
func load_data():
	if FileAccess.file_exists(user_filename):
		var save_file = FileAccess.open(user_filename, FileAccess.READ)
		var player_data = save_file.get_var()
		save_file = null

add a signal and status to the loading node

signal load_complete
var is_load_complete

func load_data():
  is_load_complete = true

on the inventory system

func _ready():
   if SaveGame.is_load_complete :
      SaveGame.load_complete.connect(self.initialize_inventory, Object.CONNECT_ONE_SHOT)