fix importing for module defs that are named "foo.bar"
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/23367
Test Plan: Imported from OSS
Differential Revision: D16478637
Pulled By: suo
fbshipit-source-id: 30c6e7bfe377ef35d8c39e2d31615075ca0a6a19