I'm using Visual Studio Code.
Suppose my folder looks like:
├── main.py
└── package
├──__init__.py
├──utils.py
└──method.py
In my method.py, I import the utils.py, which is in the same directory, so I put the dot before the name:
from .utils import *
then I can run the script in main.py like:
from package import method
This will work. But the question is, how I can run the script in method.py at its directory instead of importing it in main.py? If I run the script method.py directly, an error will occur:
ModuleNotFoundError: No module named '__main__.modules'; '__main__' is not a package
What can I do to run the script in method.py without removing the dot as from utils import *?


python -m package.method?method.py? I think, somewhere you're trying to dofrom __main__ import something