Godot Version
4.4.1
Question
So, I’m making my first 3D game and I’ve encountered a non-3D issue.
Basically, I am trying to make an inventory where you can visualise your items and
for that I made two scenes: Inventory.tscn and Inventory_slot.tscn.

And in the inventory this is the code:
(Inventory Code)
extends MarginContainer
@export var blank_slot : PackedScene
@onready var player = get_parent()
var item_database : Dictionary = {
‘item_1’ : preload(“res://resources/FirstItem.tres”),
‘item_2’ : preload(“res://resources/SecondItem.tres”),
‘item_3’ : preload(“res://resources/ThirdItem.tres”)
}
func queue_free_children():
for node in get_children(true):
node.queue_free()
func redraw_grid() → void:
queue_free_children()
for name in player.inventory_dict.keys():
var slot = blank_slot.instantiate()
var amount = player.inventory_dict[name]
var resource = item_database[name]
slot.setup(amount, resource)
if slot == null:
slot.queue_free()
return
get_node('GridContainer').add_child(slot)
#This was initially $GridContainer.add_child(slot)
pass
(Inventory_slot code)
extends HBoxContainer
func setup(amount, resource) → void:
$image.texture = resource.candy_icon
$details/text.text = ‘[center]’ + resource.name + ’ x’ + str(amount) + ‘[/center]’
$details/details.text = ‘[center]’ + resource.details + ‘[/center]’
Then, I have made the Inventory.tscn a child of the player:
Which, in the main world, is a child of the main Node3D:
And, when the call to the GridContainer in the inventory is done, I get this error:
E 0:08:10:571 inventory.gd:30 @ redraw_grid(): Node not found: “GridContainer” (relative to “/root/Main world/Player/Inventory”).
![]()
(The call is done with an input of [Ctrl + e] which I wrote in the player script)



