OK, I can do that. That's more than a little subtle of course. We are defining a complex set of workarounds at this point.
There is a very specific reason why it need that # at the start.
I do explain it in the documentation: https://lygte-info.dk/project/TestControllerFunctions%20UK.html#runScript_&_runScriptAsyncal
Tweaked spec
could be:
The name is trimmed for any blanks before/after. Then, if the name starts with # it is assumed to be the script.
Trimming blank would not help, they are generally trimmed before processing.
When the script parser do is collect line from #calc until the next # in one block and then send that block to the programming language (One the c command line it is done line by line).
If I understand correctly, in this case we have a script file, in #calc, so:
* the script parser is collecting lines after the #calc, searching for a "#" at the beginning of a line
* it will then send all of those lines as a block to the programming language.
That's both understandable and unfortunate

* Understandable: easy for the parser, since obviously a #xxx command must be for a script, not programming.
* Unfortunate: because a program can itself call a script using runScript(), and that script by definition can contain #xxx commands
* Clearly this wasn't a necessary design decision. Almost anything could have been chosen as the termination marker for #calc.
I have yet another suggestion worth about as much as you paid for it LOL. Obviously, this is your design; I'm just a user, and only for a year or so on this system

... Suggestion: for more comprehensive programs, a more stable start/end marker pair would be much simpler to code for, such as
#calcblock
(program)
#endcalcblock
Error messages are often a problem, what the parser see as a problem, is not necessary the original program.
YES they are

I have now (mostly?) debugged my 600+ line analyzer program. It's been quite the adventure decoding the error messages. I can say I am now far more familiar with the interesting error messages associated with various typos etc. Rarely do they have much to say directly about the problem. LOL.
In general, any typo or error in a program (vs script) produces a message saying #calc terminated, usually due to "Value". And that's the only hint. (For others attempting to program: adding LOTS of debug messages can help quite a bit; even so, the actual error may be several lines away from where you believe it is.

)