Dictionaries in extened script

Godot Version



I am pretty new, and trying to gather the vector data that is stored in the dictionary of another script.

I have the var potential_blocks = {}
in a separate script, and a main script that has this script extended.

in the main script I have a function that generates vector data and stores it into the dictionary, and I can confirm that everything is working as intended via this:

for position in potential_blocks.keys():
print("potential_blocks: " + str(position))

However, if I try to use this print statement on the actual script where the dictionary is stored, and not in the main one I get nothing. Can I not store data into a dictionary if it’s in another script? If I remove
var potential_blocks = {} the function stops working… so the script is extended properly. What could I be doing wrong?

is this another script with dictionary stored data extends RefCounted or extends Node?

you mean you have your main script extended this script just for so you can use the same dictionary potential_blocks on other scripts that extends it as well?

There are two scripts. One with the dictionary, and one without. The one without has “extends” the one with the dictionary, so as to be able to pull the data from it.

will need to see your code for this


I’m just trying to understand if this simple concept is even possible.