I am using PyCharm 2024.2.4.
I want to debug my current .py file, for example,
if __name__ == "__main__":
print("Hello World")
else:
print(f"__name__=", {__name__})
However, PyCharm by default uses a configuration for "Python tests", not "Python". The problem is that __name__
in Python tests is the filename, not __main__
.
I have to manually create a "Python" configuration for every python file I want to debug, which is annoying.
Is there any simple way to let PyCharm directly debug the current .py file in "Python" mode instead of "Python tests" mode?