class ID01234:
    pass


class ProcessDirector:

    def __init__(self):
        self.allClasses = []

def construct(self, builderName):
    targetClass = getattr(idClasses, builderName)
instance = targetClass()
self.allClasses.append(instance)
IDS = ['ID12345', 'ID01234']
director = ProcessDirector()
for id in IDS:
    director.construct(id)
print(director.allClasses)
Can you use a string to instantiate a class in python?