I have an object self.config which has some variables, I would like to first check if a variable ('db_password') exist in self.config and if it exists then modify the variable value something like self.config.db_password = 'modified values' . following is the python code
if hasattr(self.config, enc_variable):
setattr(self.config, enc_variable, f.decrypt(self.config.enc_variable.encode('ascii')).decode('ascii'))
AttributeError: 'Config' object has no attribute 'enc_variable'