title: How to call a method variable inside another method in Python
body: <p>I have two methods inside a class. I want to call a method's variable inside another one.
  Here is my code:</p>
  
  <p><strong>#First Method</strong>: </p>
  
  <pre><code>def starter_loan_check(self):
      #global total_offer,final_offer
      #final_offer=[]
      for i in self.overall_data:
          if i[1]=='PS' and i[3] in conf.PS_State and i[5]&gt;29:
              if i[2]!='challengerTUFT':
                  for c in cutoff_config:
                      if i[3]==c['State'] and i[2]==c['challenger'] and i[4]&lt;['CUTOFF3'] and i[4]&gt;=['CUTOFF4']:
                          if i[7]&gt;50:
                              global total_offer,final_offer
                              final_offer=[]
                              total_offer=[i for i in product(*[conf.i[3]['Loan_Amount'],conf.i[3]['Apr'],conf.i[3]['Term']])
                              #global total_offer,final_offer
                              #final_offer=[]
                              for t in total_offer:
                                  if t[0]&gt;min(i[3]['Loan_Amount']) and t[1] in i[3]['Apr'] and t[2] in i[3]['Term']:
                                      final_offer.append(t)
                                  elif t[0]&gt;max(i[3]['Loan_Amount']) and t[1] in i[3]['Apr'] and t[2] in i[3]['Term']:
                                      t[0]=max(i[3]['Loan_Amount'])
                                      final_offer.append(t)
                                  elif i[9]&gt;75:
                                      if t[0]&gt;min(i[3]['Loan_Amount']) and t[1] in i[3]['Apr'] and t[2] in i[3]['Term']:
                                          final_offer.append(t)
                                      elif t[0]&gt;max(i[3]['Loan_Amount']) and t[1] in i[3]['Apr'] and t[2] in i[3]['Term']:
                                          t[0]=max(i[3]['Loan_Amount'])
                                          final_offer.append(t)
  </code></pre>
  
  <p><strong>And I am trying to access final_offer here:</strong>
  <strong>Second Method:</strong></p>
  
  <pre><code>def starter_loan_logic(self):
      for i in  self.query1_data:
          for j in final_offer:
              if j[0]/(i[3]*.85)&gt;.30:#LTI Check
                  final_offer.remove(j)
  
              if i[2]==j[0] and i[4]=='BI_WEEKLY':
                  PTI=i[5]/((i[3]*0.85)/12)&gt;0.20
                  final_offer.remove(j)
  
              if i[2]==j[0] and i[4]=='TWICE_PER_MONTH':
                  PTI=i[6]/((i[3]*0.85)/12)&gt;0.20
                  final_offer.remove(j)
  
              if i[2]==j[0] and i[4]=='MONTHLY':
                  PTI=i[7]/((i[3]*0.85)/12)&gt;0.20
                  final_offer.remove(j)
  
              for k in self.overall_data:
                  k['state']=='IL' and i[5]/((i[3]*0.85)/12)&gt;0.225
                  final_offer.remove(j)
  </code></pre>
  
  <p>But I am getting an invalid syntax error at for t in total_offer
  Here I have tried Global but I am not sure whether I am using it correctly or not.
  please help me to understand that how can I access one function's variable inside another function.</p>