[Python] In python, if a module calls upon another module's functions, is it possible for the...

Discussão em 'Python' iniciado por Stack, Maio 7, 2025.

  1. Stack

    Stack Membro Participativo

    Without passing it as a parameter...

    Ex. In test1.py:

    def function():
    print (?????)


    and in test2.py

    import test1

    test1.function()


    Is it possible to write ????? so running test2.py prints out 'test2.py' or the full filepath? __file__ would print out 'test1.py'.

    Continue reading...

Compartilhe esta Página