I wasted a bunch of time on this, but I did figure out how to do it. The right way to do it:
- pages.rkt (the controllers) lazily imports the templates and routes. This file has to be lazily importing the others and not the reverse, because the controller functions are actually used to reverse look up the routes. Every template imported in pages.rkt unfortunately needs to be manually listed.
- routes.rkt imports pages.rkt directly
- templates.rkt imports pages.rkt and routes.rkt directly