I\'m using Python 2.7.6 and I have two scripts:
outer.py
import sys
import os
print \"Outer file launching...\"
os.system(\'inner.py\')
On linux you can get the process id and then the caller name like so.
p1.py
import os
os.system('python p2.py')
p2.py
import os
pid = os.getppid()
cmd = open('/proc/%d/cmdline' % (pid,)).read()
caller = ' '.join(cmd.split(' ')[1:])
print caller
running python p1.py
will yield p1.py
I imagine you can do similar things in other OS as well.