I managed to solve it using an Autoload level manager instance, below is the code that fixed the circular dependency.
const levels = [
func load_level(index: int):
if len(levels) <= index:
As a side note, when I closed and re opened the project with the circular dependency references, it wasn’t able to load the scenes and was throwing exceptions when trying to open them, in order to fix that I had to open the serialized file and delete one of the references that was causing the cycle.
The new loading logic allowed for this setup for each level:
@export var next_level_index: int
LevelManagerInstance.load_level(next_level_index) # The autoload instance of LevelManager
Level 1: next_level_index = 1
Level 2: next_level_index = 2
Level 3: next_level_index = 1
This causes the game to loop from the 2nd level forward, so if you finish the 3rd level you go back to the 2nd one, indefinitely.
If there is any other easier workaround, or cleaner one, please let me know. In the meantime, at least now we have a solution for these kinds of references.