This is a very confusing issue and I can't even reproduce it outside my project.
I have a node of a class that exits as a scene on a tilemap. This node is of class Player. Player is derived from Pushable, which is derived from Actor. In Actor, I have the line
@onready var level = get_parent()
This is then used anytime the node needs to interact with the TileMap level it exists in. Sometimes when I try to run my project it gives me the error: "Parser Error: Identifier not found: level" on line 16 of Player.gd. The code looks like this:
level.player = self
This error occurs for any reference to variables declared in Actor.
If I change player to extend actor it fixes the issue, so it has something to do with extending a derived class of actor
I really have no idea why this happens, at first it was only in certain scenes, but now after changes that seem unrelated (storing levels in the level select as Packed Scenes instead of Tile Map Patterns) it's happening in my main scene as well. If any more information about this is needed please ask!