What's the difference between running python file as a module executed as a script vs just running the python file? In particular, I'm wondering what the difference is between running
python -m filename
vs
python filename.py
I'm reading the documentation here: https://docs.python.org/3.6/using/cmdline.html but it's not entirely clear to me.
In particular, I notice that when I'm running a file I wrote that imports other modules I've written, it works when I run python -m filename
but when I run python filename.py
it says it can't find the module I've written. Why is this? Is this something to do with the path?