Datashapes menu's with back button


Currently I’m testing some possibilities with the UI. Now I’m trying to create a menu with a back button, where the cancel-button re-initiates the first menu in which you can make a selection again. Basicly creating a structure of menu’s where you can go back and forth throug the menu’s.
At first it seemed that it was not possible, where the nodes would get corrupted with this error message: “Warning: A cyclic dependency exists between two variables”. However… after messing around a bit I actually managed to get the back button to function. But then after setting a value in a sub-menu dynamo freezes.

Is there a way to do what I described? If yes how?

Here’s how I did it in steps,
Important, put Manual run on.

  1. Create the nodes but not yet connecting the output of the “Was canceled” to the toggle of the first menu.
  2. Then run the program, choosing a menu, then exiting so the last code block outputs true.
  3. Lastly connecting the last code block to the start menu. And running again, it is now possible to go back and forth between menu’s.
  4. When setting a value in one of the sub-menu’s Dynamo crashes.

Currently I’m not even able to replicate it myself, somehow it’s really inconsistent.