Mack's LoL Scout
Explain

Running code: python file.py vs python -m ...

This project uses python -m src.scout because it keeps imports and folders sane as your code grows.

TL;DR

  • python path/to/file.py runs a file by path.
  • python -m package.module runs a module by name.
  • python -m src.scout runs src/scout/__main__.py.

What -m expects

When you run python -m src.scout, Python looks for a folder named src, then a folder named scout inside it, then runs __main__.py.

The minimum structure

src/
  scout/
    __main__.py

The most common “beginner trap”

You run the command from the wrong folder and Python can’t find src.

The error

ModuleNotFoundError: No module named 'src'

Fix: cd into the project root (the folder that contains src/).

Optional: __init__.py

If you still get import weirdness, adding empty __init__.py files makes your folders explicit Python packages.

Optional package nudge

src/__init__.py
src/scout/__init__.py