I tried that first, but unfortunately by this point self is not defined and returns a NameError.