title: How to resolve attribute error in python
body: <p>on the begin I'll say that I was looking for the answer but can't find it and sorry for so basic question.I created program with TTS. I created global variable called "list_merge", but most of you said that global variables are BAD. So I decided to put this list in init. PS. ignore whitespaces, they exist only because I copied it here.</p>
  
  <p>the error is: 
  AttributeError: 'Ver2ProjectWithTTS' object has no attribute 'list_merge'</p>
  
  <pre><code>import json
  import pyttsx
  from openpyxl import load_workbook
  
  class Ver2ProjectWithTTS(object):
  
      def __init__(self):
          self.read_json_file()
          self.read_xml_file()
          self.say_something()
          self.list_merge = []
  
      def read_json_file(self):
          with open("json-example.json", 'r') as df:
              json_data = json.load(df)
              df.close()
          for k in json_data['sentences']:
              text_json = k['text']
              speed_json = int(k['speed'])
              volume_json = float(k['volume'])
              dict_json = {'text': text_json, 'speed': speed_json, 'volume': volume_json}
              self.list_merge.append(dict_json)
  
      def read_xml_file(self):
          tree = et.parse('xml-example.xml')
          root = tree.getroot()
          for k in range(0, len(root)):
              text_xml = root[k][0].text
              speed_xml = int(root[k][1].text)
              volume_xml = float(root[k][2].text)
              dict_xml = {'text': text_xml, 'speed': speed_xml, 'volume': volume_xml}
              self.list_merge.append(dict_xml)
  
      def say_something(self):
          for item in self.list_merge:
              engine = pyttsx.init()
              engine.getProperty('rate')
              engine.getProperty('volume')
              engine.setProperty('rate', item['speed'])
              engine.setProperty('volume', item['volume'])
              engine.say(cleared_text)
              engine.runAndWait()
  
  if __name__ == '__main__':
      a = Ver2ProjectWithTTS()
  </code></pre>
  
  <p>I'm getting
  AttributeError: 'Ver2ProjectWithTTS' object has no attribute 'list_merge'</p>
  
  <p>Any ideas how to avoid this error? Well i'm not good in objectivity and I just cant move on without fixing this. PS. with global variable before init def it worked properly.
  Thanks for help :)</p>