I am guessing you are trying something like this
[{"id":"ad5eef7f39059301","type":"subflow","name":"Subflow 1","info":"","in":[{"x":50,"y":30,"wires":[{"id":"45c4966f7f134590"}]}],"out":[{"x":180,"y":40,"wires":[{"id":"45c4966f7f134590","port":0}]}]},{"id":"45c4966f7f134590","type":"change","z":"ad5eef7f39059301","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$flowContext(\"$parent.test\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":80,"y":80,"wires":[[]]},{"id":"8747459b87531dd6","type":"subflow:ad5eef7f39059301","z":"d1395164b4eec73e","name":"","x":340,"y":5200,"wires":[["6e1e6aecccf74fd9"]]},{"id":"30daf90d4c913ea6","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":260,"y":5160,"wires":[["74c429fed661ae92"]]},{"id":"74c429fed661ae92","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"set","p":"test","pt":"flow","to":"I am here","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":5160,"wires":[[]]},{"id":"5a0781685c5f1416","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"str","x":210,"y":5200,"wires":[["8747459b87531dd6"]]},{"id":"6e1e6aecccf74fd9","type":"debug","z":"d1395164b4eec73e","name":"debug 2485","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":490,"y":5200,"wires":[]}]
If not I may be best to provide an example flow.
The syntax is $flowContext("$parent.var_name")
You can find it in docs here Working with context : Node-RED