How to draw a text using the bge module II
A python controller will run the script from top to bottom, the same as if you were running any python script.

The code you show defines two functions but does not call them. I expect you need to add a call to the functions for your script to work.