I have a module in my PYTHONPATH that looks like this:
module.py
from __future__ import absolute_import
import foo
foo.do_something()
print("I am a module!")
I later call this script using python -m module. The script works most of the time but I found that I'm cd'ed into a directory which has a folder with foo/__init__.py inside of it, Python prefers that folder over the other foo module in my PYTHONPATH. I assume it's because Python is treating the foo folder as an implicit, relative import (I'm using Python 2.7).
How do I get Python to not treat the folder in the $PWD as an implicit relative import?
from __future__ import absolute_import does not work
module.py and every other module I use has from __future__ import absolute_import included. So existing questions such as Python: Disabling relative import do not solve this issue.