I'm marking this as a potential bug here so that my partner can reference it. I'm running Qlik Sense Server - April 2018.
Attached is an example of code where I load a subroutine at the beginning of my script based on a variable and then call the subroutine. In the first case, where the calling of the subroutine is within the same If statement, code execution completes without issue. However, if you switch the variable value to load the other subroutine, which is called further down in the script, you get a Semantic Error. Both subroutines are identical (empty) so it doesn't have anything to do with the code within them.
Does anyone know if this is a bug or if Qlik intentionally limits the retention of the subroutine code to the bounds of an If statement?