Here's my findings on this in case it helps anyone.
Context options are the way to go. They set variables that can be referenced with the @ syntax.
They can be set manually in the Context Options editor but can also be changed in your node tree.
There are two approaches I've found, each with their own pros and cons.
Edit Context Options LOPThis has a nice interface that allows you to set context options.
Confusingly (at least for me)
this will set the context values up the node tree rather than down.
So this node needs to be placed
after any node that needs to reference the variables it sets.
Python Script LOPhou.setContextOption('name', 'value')
This lets you set values that can be referenced globally, so both up and down the node tree (and even in separate disconnected node trees, so be careful).
Important to note that
context options set with the python script are persistent, so if you bypass or even delete the python script LOP the context option will still be set. I'm not sure if this is a bug or intended but it's something to be aware of.
For my purposes this time I went with the Python Script LOP as I have structured my network such that the shot variables are set at the top of the netork and need to flow down. I don't really recommend this approach though.
In future I will try reorganising my networks to make them work with the Edit Context Options LOP as that is much more controlled (i.e. the context options are only set for specific nodes in the network and this can even be limited with context options blocks).