I need to check if module exists (without checking if their import modules exists), import the module to check if it exists is a bad idea because:
foo/module_A.py:
import invalid_module_asdfghjkl
class ClassA:
pass
foo/module_B.py:
try:
__import__('foo.module_A')
except ImportError, e:
>>> No module named invalid_module_asdfghjkl
So, My module exists, but not one of their imported modules, how can I check IF MY MODULE EXISTS when it has invalid imports?