os.getppid()

os.getppid() → ppid

Return the parent’s process id.