Rather than rely on Python's function-level scoping for this to exist later on in the function, could you just redefine? Alternatively, define them at the top of the function with a default empty string value.