Fix import_string masking of AttributeError

* Fixes edge case where import_string hides AttributeErrors happening
  inside the module being imported, and instead raises them wrongly as
  ImportErrors. The included test case may look very sought, but in
  large applications this may happen. In our case it was during replacement
  of warnings.showwarnings (closes #182).

Co-authored-by: Jiri Kuncar <jiri.kuncar@cern.ch>