I need to connect the class, with the file name and class indicate the variable.

from переменная import переменная 
  • Maybe exec () or eval ()? Better, write more in detail - skegg


2 answers 2

 module = __import__('module_name') # Импортируем модуль module_name A = getattr(module, 'A') # Получаем класс A из модуля 

    Can be completely stupid

     imp = 'from %s import %s' % (module_name, class_name) exec (imp)