billowy-dawn-22612
10/05/2023, 12:08 PMpants run executes my file two times? I'm using run to debug some code, but the stdout indicates that everything executes twice. I can reproduce by just calling a python file libs/some-project/some_module/__init__.py containing print("hello")
Ex:
$ pants run libs/some-project/some_module/__init__.py
hello
hellogorgeous-winter-99296
10/05/2023, 12:24 PM$ mkdir foobar
$ echo 'print("hello")' >> foobar/__init__.py
$ python -m foobar.__init__
hello
hello
The reason is that it has to import the module foobar before executing __init__.py .billowy-dawn-22612
10/05/2023, 12:31 PMpants that I did not even think about Python workings. Thank you!