Does ui-template script have access to context?

I have a ui-template node in which I'd like to access some data using flow.get() from within script tags. Should that be possible? I have a very simplified flow to test that with just a plain varaiable but it doesn't work - execution stops doing flow.get()

[{"id":"5f1dce96.0c0ea8","type":"ui_template","z":"5025a90b.1be418","group":"6646c330.b6a0a4","name":"qwerty","order":0,"width":"10","height":"15","format":"\n\n<style>\n    .buttons {\n        width: 160px;\n        height: 30px;\n    }\n    [value=\"off\"] {\n        /*background-color: #999999;*/\n        color: -internal-light-dark(black, white);\n        background-color: -internal-light-dark(rgb(239, 239, 239), rgb(59, 59, 59));\n        border-color: -internal-light-dark(rgb(118, 118, 118),rgb(133, 133, 133));\n    }\n    [value=\"on\"] {\n        /*background-color: #000000;*/\n        color: -internal-light-dark(black, white);\n        background-color: rgb(178, 178, 178);\n        border-color: -internal-light-dark(rgb(118, 118, 118),rgb(133, 133, 133));\n    }\n    .holder {\n        display: flex;\n        flex-direction: column;\n    }\n    .deviceList {   /* A set of radio buttons */\n        background-color: #a1a1a1;\n        min-height: 200px;\n        min-width: 490px; \n        margin-top: 10px;\n        margin-bottom: 10px;\n    }\n    .deviceList input[type=\"radio\"] {\n        display: none;\n    }\n    .deviceList label {\n        display: flex;\n        flex-direction: column;\n        background-color: #a1a1a1;\n        padding: 4px 11px;\n        font-family: Arial;\n        font-size: 16px;\n        cursor: pointer;\n    }\n    .deviceList input[type=\"radio\"]:checked+label {\n        background-color: #76cf9f;\n    }\n    .readClearDataButtonHolder {\n        display: flex;\n        flex-direction: row;\n        justify-content: space-between;\n    }\n    .alignButtonRight {\n    }\n    .textArea {\n        background-color: #a1a1a1;\n        min-height: 220px;\n        min-width: 480px; \n        margin-top: 10px;\n        margin-bottom: 10px;\n        resize: none;\n        padding: 0;\n    }\n</style>\n\n\n<!-- FIND DEVICES -->\n<div id=\"findDevicesButtonHolder\">\n    <button id=\"findDevicesButton\" class=\"buttons\">Find devices</button>\n</div>\n<div id=\"deviceListHolder\" class=\"deviceList\">\n</div>\n    <!-- DEVICE INFO -->\n<div id=\"infoButtonHolder\">\n    <button id=\"infoButton\" class=\"buttons\">Device info</button>\n</div>\n<div id=\"infoAreaHolder\" class=\"infoAreaHolder\">\n    <textarea id=\"infoArea\" name=\"infoArea\" class=\"textArea\" rows=\"1\" cols=\"49\" disabled></textarea>\n</div>\n    <!-- DEVICE DATA -->\n<div id=\"readClearDataButtonHolder\" class=\"readClearDataButtonHolder\">\n    <div class=\"alignButtonLeft\">\n        <button id=\"readDataButton\" class=\"buttons\" value=\"off\">Read data</button>\n    </div>\n    <div class=\"alignButtonRight\">\n        <button id=\"clearDataButton\" class=\"buttons\">Clear</button>\n    </div>\n</div>\n<div id=\"dataAreaHolder\" class=\"dataAreaHolder\">\n    <textarea id=\"dataArea\" name=\"dataArea\" class=\"textArea\" rows=\"1\" cols=\"49\" disabled></textarea>\n</div>\n\n<script>\n    (function(scope) {\n        let timer;\n        \n        infoButton.addEventListener('click', function (e) {\n            if (event.detail === 1) {\n                timer = setTimeout(() => {\n                  infoArea.value = infoArea.value + \"\\nCLICK\";\n                }, 300);\n            }\n        });\n        infoButton.addEventListener('dblclick', function (e) {\n            clearTimeout(timer);\n            infoArea.value = infoArea.value + \"\\nDBLCLICK\";\n        });\n        \n        scope.$watch('msg', function (msg) {\n            if (msg.payload == \"newDevice\") {\n                dataArea.value = dataArea.value + \"\\nAAA \" + msg.payload;\n\n                // Testing flow context here\n                var avar = flow.get(\"atest\") || 5;\n                dataArea.value = dataArea.value + \"\\nZZZZZ \" + avar;\n\n                \n            }\n        });\n        \n        \n    })(scope);\n    \n</script>\n\n\n\n\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":670,"y":200,"wires":[[]]},{"id":"6646c330.b6a0a4","type":"ui_group","name":"Default","tab":"ba47fdb1.029a08","order":1,"disp":false,"width":"10","collapse":false},{"id":"ba47fdb1.029a08","type":"ui_tab","name":"X-keys Device Finder","icon":"dashboard","disabled":false,"hidden":false}]

even though context tab in right side bar correctly displays availability of the "atest" flow context. When injecting a newDevice event, I would expect the script in the ui-template to access "atest" (as set by "set/log context var" function node) and display the value in the bottom text area of the dashboard display.

Presuming that context is not available from within the script tags, is there an alternative method to share access to objects between nodes? The test flow uses just a simple variable but my real world usage involves a reasonably complex object.

Thanks for any advice,
chris