My current solution is the following but it's a bit hacky. I create a Null node in the OBJ context and create a parameter for each context option and set the value to the context option attribute e.g. @shot. Anything that needs to use this context option references the parameter. In the TOPs Wedge node I create an attribute with the same name and values as the context option and set Target Parameter to push the value to the parameter in the Null node.
It would be nice if using an attribute in a parameter without a prefix (e.g. @shot instead of C@shot or P@shot) would work like the following: if a PDG attribute exists (and you're inside a cooking TOPs work item) use that, if it doesn't, use the context option attribute. Unfortunately context option attributes always override PDG attributes. You can do it in Python but it's a bit verbose:
import hou, pdg work_item = pdg.EvaluationContext.workItem() if work_item is not None and work_item.state == pdg.workItemState.Scheduled: shot = work_item.attribValue("shot") else: shot = int(hou.contextOption("shot")) return hou.text.expandString(f"$HIP/render/shot_{shot}/$F4.exr")
How do others solve this issue?