Run "__main__.py" with relative import directly in IDLE

This is the feature:

Add an option “run as main module” in IDLE. The condition to unlock this option is:

  • The file is “__main__.py”.
  • In same path there is a file named “__init__.py”

The effect is running the code with variable __package__ = "<my_module>". This name is based on the path.

1 Like