Error with "Node not found: "Icon" (relative to "PanelContainer")"

Question

I was following this tutorial of how to make a inventory system in Godot, (here) and I encountered an error when I ran it at 11:25 in the video. The particular error is “Node not found: “Icon” (relative to “PanelContainer”)” and in stack trace it says “Invalid access to property or key ‘Icon’ on a base object of type ‘Resource (Item)’”. Can I get any help on this? The code for my project is below. I’m new to coding in Godot so sorry if this is a simple fix.

Item Script

extends Resource
class_name Item

@export var title: String
@export var icon : Texture2D
@export_multiline var description : String

Inventory Slot Script

extends PanelContainer

@export var item : Item:
	set(value):
		item = value
		$Icon.texture = item.Icon

func _on_mouse_entered():
	if item != null: 
		owner.set_description(item)

Ui Script

extends Control

@export var description : NinePatchRect

func set_description(item: Item):
	description.find_child("Name").text = item.title
	description.find_child("Icon").texture = item.icon
	description.find_child("Description").text = item.description

Screenshot (82)

Make sure the Icon node is a child of the Slot node.

Unless the script of the Item class is longer, it doesn’t have a member named “Icon”(capped). The variable declared in it is icon (uncapped).

The icon node is a child of the slot node but whenever I make both capped, (the variable in Item Script and the $Icon.texture) I get

Invalid assignment of property or key ‘texture’ with value of type ‘Nil’ on a base object of type ‘null instance’.

but if I make them both uncapped I get

Invalid assignment of property or key ‘texture’ with value of type ‘CompressedTexture2D’ on a base object of type ‘null instance’."

and if I make variable in Item script capped and the $Icon.texture uncapped I get

Invalid access to property or key ‘icon’ on a base object of type ‘Resource (Item)’.

Am i fixing it correctly or am I missing something?

It’s so uncomfortable to see your description.
What do capped and uncapped mean?
I just misread and thought put the Item directly into the node tree.
You used exported variables, So should pay attention to the operation.
Before replacing resources, it is necessary to check whether the node has completed loading.
Also need to replace the entire resource.
eg:

var it=Item.new()
it.icon=Texture2D.new()
it.title="new title"
it.description="new description"
if is_node_ready():
	item=it

Capped means to Capitalize and uncapped means when it’s not Uncapitalized, also I put your code into my script but I keep getting errors like

Function “is_node_ready()” not found in base self.
Identifier “item” not declared in the current scope.

Code for reference

extends Resource
class_name Item

func _ready():
	var it=Item.new()
	it.icon=Texture2D.new()
	it.title="new title"
	it.description="new description"
	if is_node_ready():
		item=it