Is there a way to use a string (in my case read from a file) to find a class with the name matching the string, then create an instance of that class. For example:
class FirstClass:
def __init__(self, arg1):
self.arg = arg1
values = ','.split('FirstClass', 'argument')
# need the magic for this:
values[0](*values[1:])
But of course using values[0]
doesn't work there, because it's a string, not a class. Is there a way to automatically convert the string to the class there? Especially if I have many classes and cannot know in advance which one to instantiate, like reading the values from a CSV and wanting the right class to handle a line.