Leo Yee wrote: > Does anyone know what I should do to solve this problem? Thanks in advance. The global declaration must go in each function that uses the global variable, and not in the global namespace defining the variable (in the global namespace, it is clear that the variable is global, so no need to declare that). Regards, Martin