To declare that you want to access global variables, use a statement of the form
globalv0,v1, ...
This is not actually necessary unless you are assigning a value to the variable before using it, which normally leads Python to conclude that the variable is local.