What you can do is to wrap the invocation into a function of its own.
So that
foo()
def foo():
print "Hi!"
will break, but
def bar():
foo()
def foo():
print "Hi!"
bar()
will be working properly.
General rule in Python
is not that function should be defined higher in the code (as in Pascal
), but that it should be defined before its usage.
Hope that helps.