Rewriting a pluggable AI finite state machine from Unity to Godot

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Schala

So, Godot has been catching my eye recently and I’ve been learning it on weekends, since during the week I’m in game design school using Unity. I found an interesting lesson on my own about writing a pluggable finite state machine for AI in Unity.

I want to go ahead and try implementing this in GDScript/Godot, because it seems pretty straightforward. However, one of GDScript’s limitations is that it cannot have scripts with cyclical references (Foo.gd can’t reference Bar.gd when Bar.gd already references Foo.gd) and the PFSM I coded in Unity has, for example, a State class that references the StateController class as an argument to a delegation method, while the StateController class itself has a few State variables.

I don’t know what to do. Does GDScript support forward declarations? Or is there another workaround?