def bar(): print 'in bar()' def foo(): print 'in foo()' bar() foo() # In fact, we can even declare foo() before bar(): def foo(): print 'in foo()' bar() def bar(): print 'in bar()' foo()