Note: I'm using v3.3.2
I had the same issue. For me, the actual problem was preloading - in an autoload script - a script which referenced another autoload script. See the following simplified example of the problem and then the solution afterward.
Autoscripts (in order)
Config.gd
enum TILE_TYPE {NONE, FLOOR, WALL}
Global.gd
var Tile = preload("res://Tile.tscn") # <-- This caused the error
var tile = Tile.instance()
# do stuff with tile
Non-Autoscripts
Tile.gd
export(Config.TILE_TYPE) var type = Config.TILE_TYPE.NONE
By removing the preload of Tile.tscn from Global.gd, the error went away. For me, this is an acceptable solution because I'm realizing in hindsight that instancing Tiles elsewhere is more appropriate.
I also verified that referencing enums in Config.gd from within Global.gd works. E.g.
Global.gd
func IsAWall(pTileType) -> bool:
return pTileType == Config.TILE_TYPE.WALL
If you need to preload - in an autoload script - a scene which references enums in another autoload script, similar to what I was doing in Global.gd, then you need to preload the autoload script similar to one of the following examples, depending on your use case.
Tile.gd
export (preload("res://Game/Config.gd").TILE_TYPE) var type
OR
const TileTypes = preload("res://Game/Config.gd").TILE_TYPE
Hope this helps others!