def pd(*args):
 f = inspect.currentframe()
 f = inspect.getouterframes(f)[1][1]
 f = (((f != '<stdin>') and f) or os.getcwd())
 return os.path.join(os.path.dirname(os.path.realpath(f)), *args)

def pd ( * args ) : f = inspect . currentframe ( ) f = inspect . getouterframes ( f ) [ 1 ] [ 1 ] f = ( ( ( f != '<stdin>' ) and f ) or os . getcwd ( ) ) return os . path . join ( os . path . dirname ( os . path . realpath ( f ) ) , * args )
returns the path to the parent directory of the script that calls pd() + given relative path .