I have a class (say called Account) saved a as a variable (say cur_class) and I want to initialize an instance of the class. I thought
cur_class.__init__()
would work but it is giving me ‘unbound method init() must be called with Account instance as first argument (got nothing instead)’. Obviously I’m doing something wrong – can anyone point me in the right direction?
Thanks,
Richard
Try
cur_class(). For example:A slightly longer explanation is that Python classes are callable. Calling a class returns a new instance.