Var keeps getting reset

Godot Version

4.2.1

Question

so im trying to pick up an item in my inventory, and be able to drop it into any empty slots. ive got everything done for it to work but for some reason this one var that i need to reference is getting reset even though the code is only being run once i dont know what im doing wrong.

extends Control

const GODOT_ITEM = preload("res://godot_item.tres")
const DUST_ITEM = preload("res://dust_item.tres")
@onready var player_inv : Inv = $".".get_parent().inv
@onready var slots : Array = $NinePatchRect/GridContainer.get_children()
@onready var grabbed_slot = $Grabbed_Slot
var is_open = false
var is_grabbed : bool = false

var grabbed_slot_data : Inv_Slots

func _ready():
	for index in player_inv.slots.size():
		slots[index].slot_clicked.connect(on_slot_clicked)
	player_inv.update.connect(update_slots)
	close()

func _process(_delta):
	if Input.is_action_just_pressed("E"):
		if(is_open):
			close()
		else:
			open()
	grabbed_slot.global_position = get_global_mouse_position() + Vector2(4,4)

func update_slots():
	for i in range(min(player_inv.slots.size(),slots.size())):
		slots[i].update(player_inv.slots[i])

func on_slot_clicked(slot_index,node_path):
	for s in player_inv.slots.size():
		if slot_index == s:
			var clicked_slot_node = node_path
			var clicked_slot_data = player_inv.slots[slot_index]
			if !clicked_slot_data.item == null:
				if !is_grabbed:
					grabbed_slot_data = player_inv.slots[slot_index]
					grabbed_slot.grabbed_slot_update(clicked_slot_data)
					toggle_grabbed_slot_vis()
					is_grabbed = true
					print(grabbed_slot_data.item)    # returns the correct item resource
					clicked_slot_data.item = null
					clicked_slot_data.quantity = 0
					print(grabbed_slot_data.item)# here it now gets affected by the 2 lines above and is null
				else:
					print("already holding something")
			else:
				#print("nothing to grab")
				if is_grabbed:
					print(grabbed_slot_data.item)
					#clicked_slot_node.insert_grabbed_slot(grabbed_slot_data)
					#is_grabbed = false
			update_slots()

the var grabbed_slot_data is only set once but between the 2 prints above its data is nulled even though it never gets called again to be updated. ive ran print functions all over the for statement to see if its running it multiple times but nothing.

This is because its a reference. They both reference the same item, when you set it to null it will be null for both