As a contribution towards workarounds or hacks to get things done, I present this demo of a Global Function Hack.
https://x.thunkable.com/copy/73d9acde23febf02fcebd3efb8d91d53
The project has 2 screens. I have the function in screen 1 but I am calling it from screen 2. You will see that every time you click the button in screen 2, the function in screen 1 is executed and the result is shown in the label in screen 2.
I looked around quickly in the screen captioned scrGlobalFunctions but could not figure out how it is implemented. I may need to look again, maybe it is done in a better way.
It seems so. Even though the screen is not the active one, the timer Fires block runs once you set the timer enable to true.
I also found out that if you keep all timer options in the setup screen disabled then it will only run once which is what I was looking for. At first I was keeping an extra block of code in the function to turn the timer enable option to false but then I realized I do not need it.
This gave me an ideia, what if we could update the label in screen 2 on resultHandler change event?! I tried it but with no sucess .The event is not fired when resultHandler changes inside the timer
Just to extend the demo of Global Function further than just adding two variables, I created another function in the first screen. This time the function executes Web API and saves the response to a variable.
I also created a third screen that runs this function and then waits for the variable to get updated and show the response of the Web API located in screen 1 in the labels of screen 3.
Another enhancement in this demo is in the timer component which now has a conditional parameter to decide which function to execute making use of one single timer to run more than on function as inquired by @paulovaz72