from inspect import currentframe getouterframes def some_outer_func de

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
from inspect import currentframe,getouterframes
def some_outer_func():
def some_innerfunc():
frame_stack=getouterframes(currentframe())
outer=frame_stack[1]
frame,source,lasti,oname,lines,unk=outer
obj=frame.f_globals[oname]
print "I was called by",obj,"with name",oname
some_innerfunc()
some_outer_func()