Fixed #17061 -- Factored out importing object from a dotted path

Thanks Carl Meyer for the report.