In my script, I have accessed three nodes:
onready var weaponScrollContainer = $CenterContainer/InventoryBackground/VBoxContainer/HBoxContainer/Tabs/WeaponScrollContainer
onready var armorScrollContainer = $CenterContainer/InventoryBackground/VBoxContainer/HBoxContainer/Tabs/ArmorScrollContainer
onready var itemScrollContainer = $CenterContainer/InventoryBackground/VBoxContainer/HBoxContainer/Tabs/ItemScroll
these nodes are stored as weaponScrollContainer, armorScrollContainer, and itemScrollContainer. I switch between these three nodes in the scene, so I created a variable called "currentTab" to store the node that is currently active.
When I try to run this script, however:
if currentTab != weaponScrollContainer:
currentTab.visible = false
currentTab = weaponScrollContainer
currentTab.visible = true
It raises an error saying currentTab is null. I was absolutely baffled by this, and when I printed the currentTab variable it printed null for the first iteration, then the correct node for every following iteration.
I have no idea what could cause this, any help?