How do I fix this error? The game won't run and it tells me that the script global.gd is a cyclic dependence. As far as I am aware there is no scenes referencing this and it is just used as an autoload. I tried changing global.gd to not preload anything. I tried testing with a custom scene and it still doesn't recognize global.gd as an indentifier despite it coming up on the list of autoloads.
Considering load doesn't load at runtime because I replaced preload with load. I am guessing it is not a load error.

I also tried testing a test scene that has hardly any nodes and just works as a test environment.

I could copy the whole debug message here but I somehow feel like this is a common error and just need to find some advice.

    This happens when two scripts reference each other. So let's say you have script A.gd and script B.gd

    A.gd:

    var B = get_node("B")
    B.some_var = 1

    B.gd

    var A = get_node("A")
    A.some_other_var = 2

    This will never work. Then will start calling each other, then calling the other one, then back to the first one, forever in a loop and crash your computer (the cyclic error stops the crash).

    When you use an Autoload (Singleton) it is implicitly available to all other scripts. Meaning if the Autoload calls one of those other scripts, depend on how you have it set up, that could trigger it.

    Two ways to fix this is to never reference other scripts in the Autoload, and simply use it for storage or independent functions.

    Or you could use signals as a way to pass messages back and forth. However, the Autoload still can't know about the other scripts, so you have to send signals both ways (basically the autoload will act as a message bus or dispatcher).

    zerohootsoliver okay, so it's not the code... possibly.

    It says Global not declared? Did you remove it from the Autoload in the editor settings or just "delete" the file? Because if it's still in the Autoload it's probably still trying to reference it?

    I would still post the code, and maybe your SceneTree.

      Could be a naming issue. It works best if the file name, class name, and reference name are all the same (case does matter I believe).

        SnapCracklins

        I had removed and re-added the global.gd autoload. How can it still be referencing the autoload? I am trying to reference the Global autoload and it doesn't exist. It tries to reference a member variable which doesn't exist. But I assumed that this wasn't the problem because it says the error is to do with the 'Global# identifier.

        cybereality

        I had checked to make sure the file name, class name and reference name are all the same for the autoload and it still has the same 'Parser Error: The identifier "Global" isn't declared in the current scope.'

        I checked the SceneTree remotely and it just had root. So unless there is something I'm missing, this is just a vague parser error.