I've noticed that __import__('pdb').set_trace() is handled differently than import pdb; pdb.set_trace():
% mypy =(echo "__import__('pdb').set_trace()"; echo "import pdb; pdb.set_trace(); pdb.meh")
/tmp/zshkq7d0B:1: error: Module has no attribute "set_trace"
/tmp/zshkq7d0B:2: error: Module has no attribute "meh"
Found 2 errors in 1 file (checked 1 source file)
I think this should behave the same.
I've not checked other modules, but pdb.set_trace is in typeshed.
mypy master (28423cd)