binaryGrid is not on global scope, it is on class member scope of your script (script = class too, even if they have no name). In fact, global variables don't exist in Godot.
Then you defined a class which is nested in that script, but that doesn't mean it can access to member variables of the enclosing class, it's not the way it works in Godot. Subclasses are just like any other class, they don't have a magical scope being included.
You have to pass this grid to your
Miner as a dependency if you want to access it, for example you pass it in the
_init(x, y, mine) and store it in a member var of
Or, as I see in your script, you could pass the instance of the enclosing script to your
Miner instance, so you can write
this is undefined, use
Note 2: my proposal above would work if your mine is a node, or an
Object. If it was a resource or a
Reference (scripts extending nothing are), it would produce potential cyclic references.