def foo():
# code
def foo_in_foo():
# code
# что-то вроде того:
foo.foo_in_foo()
>>> def foo():
... print('executing foo()')
... def foo_in_foo():
... print('executing foo_in_foo()')
... global inner
... inner = foo_in_foo
...
>>> foo()
executing foo()
>>> inner
<function foo.<locals>.foo_in_foo at 0x07BBD1E0>
>>> inner()
executing foo_in_foo()