If I call a subroutine from the main program (using the
RUN | sub123 command), what is the official logic regarding variable visibility?
- Can the RPA software see the main macro variable inside the sub?
- Are subroutine variables known to the main macro?
You have to put the word “GLOBAL” in front of your variable to make it visible in subroutines. like “GLOBAL_myVar”. That variable will be valide as long as you don’t close the kantu window. So if you start a script a second time without closing the kantu window, this variable with it’s value can be used again. This is also helpful for testing scripts while building.