It might seem unusual but I am making a credit card verification software in tkinter and I want to know if it is possible to access class instances via strings in python. Like I am doing below with the string
variable.
This is a 'watered down' example of what i'm trying to do:
class myclass:
def __init__(self, name):
self.name = name
def print_name():
print(self.name)
adam = myclass('adam')
string = 'ad' + 'am'
string.print_name()
It gave me an AttributeError
as I would expect but I don't know if there is an answer to this; I don't think there is as I couldn't find anything but it would be good if there is a way.