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()