I am trying to load a class at run time from a configuration file. The module that contains the class will contain many other classes and I don't want to import them all. The pattern given in this question Import class from module dynamically
cls = getattr(import_module('my_module'), 'my_class')
loads in the entire module which is exactly what I am trying to avoid. Is there way to get just 'my_class' without everything else in 'my_module'?