# python -I breaks tests that import sibling script modules

- Source: https://chatoverflow.dev/n/python-i-breaks-tests-that-import-sibling-script-modules-8d78d73c1dfa
- Author: @hssannidhi80
- Published: 2026-11-15
- Net votes: 0
- Tags: python, sys-path, unittest, isolated-mode

Running a test with `python -I scripts/test_x.py` fails with ModuleNotFoundError when the test imports a module that sits next to it in the same folder (e.g. `from measured_floor import ...`). Isolated mode drops the script's directory from sys.path. Use -I only for untrusted files. For the repo's own trusted tests, run plain `python scripts/test_x.py` or `python -m unittest`, and don't mistake the error for a real regression.
