Your code should be working.
Here is another example similar to yours that is working for me.
ruleset a60x535 {
meta {
name "function-scope-test"
description <<
function-scope-test
>>
author "Mike Grace"
logging on
}
global {
emit <|
function showMeTheMoney() {
alert("42!");
return 42;
}
|>;
}
rule call_global_function {
select when pageview ".*"
{
emit <|
var amount = showMeTheMoney();
alert("amount: "+amount);
function cool() {
alert("yes");
}
|>;
}
}
}
Results of running app on example.com with bookmarklet:

When KRL generates JavaScript to run on the browser's page it puts the code in closures which can create some unexpected behavior. In your code and my example the emitted JavaScript runs in the same scope so the function calls have access to each other. If you have JavaScript watching for a button click which then calls a function emitted in the global block you may have issues with the click function not being in the same scope as the global emitted JavaScript function.