Should't the changeSex method be: def changeSex(self, newsex=""): self.sex = newsex return self.sex You're creating a new instance variable at the moment i.e 'self.mysex' doesn't exist until you call changeSex.