After fighting with typst *all day* because of it's lack of any cross-file introspection, I have finally made myself a workaround that works and doesn't make me horribly anxious.

Just set a bunch of show rules so that your include doesn't render anything in the final document! If you do that, your labels and state variables all import just fine! This totally won't break!

I hate it, devs please let me query another file, please.

#typst

@benrob0329 you mean importing stuff from another file? Do you have a quick example?

@beeb The project is open source, so you can actually see the full context!

I take this function:
https://gitlab.com/uune/core/-/blob/master/lib/uune.typ?ref_type=heads#L134

And I use it to invisibly include a couple documents in this file so that I can quote pieces of them throughout:
https://gitlab.com/uune/core/-/blob/master/src/tutorial.typ?ref_type=heads#L10

The quoted files have sections and sub-sections labeled for easy quoting without having to convert the whole thing to a needlessly complex nested data structure:
https://gitlab.com/uune/core/-/blob/master/lib/srd.typ?ref_type=heads

lib/uune.typ · master · Uune / Core · GitLab

The main reference for Uune's core rules, sheets, and typst library.

GitLab