`from . import module as mod` vs `import module as mod`?

  docker, python, python-3.x

Under the same directory, I have a main.py and a module.py. I want to call module.py from main.py using the handle mod. Normally, what I’d just write in main.py:

import module as mod

However, I found out by dumb trial and error that the above does not work when I’m in a Docker container. In such cases, I’d need to write

from . import module as mod

which in turn wouldn’t work in a "normal" environment, i.e., on my local machine.

I have a vague suspicion that this has something to do with pathnames, but it’s not clear to me why things work this way. Ideally, I would have liked the Python code to work the exact same way regardless of whether it’s run from within a container or not.

Source: Docker Questions