how do I define a function, wherewhich can indicate where it was executed, without the arguments passed to? all files in ~ / app /
a.py:
def where():
return 'the file name where the function was executed'
b.py:
from a import where
if __name__ == '__main__':
print where()
c.py:
from a import where
if __name__ == '__main__':
print where()
source
share