What changes when you run Python with -m?

· Python Developer Tooling Handbook – pydevtools.com · Nov. 25, 2026, 8:53 p.m.
Summary
This blog post explains the difference between running Python scripts with the `-m` option versus directly using the file path. It highlights how `-m` establishes a package context which is crucial for relative imports, while direct execution does not. Key details about how Python sets up the environment for both methods are compared.