title: use variable in class A to be in class B in python
body: <p>I'm trying to use a variable that's defined in class A in class B. Basically I need the users entry in class A to be the file name as data I save in class B Here's my code:</p>
  
  <pre><code>class A(object):
  
      def __init__(self, master):
         self.master = master
         self.labelSub=Label(self.master, text="Participant No.")  #where users their name
         self.entrySub=Entry(self.master,bg="grey")
         A.csv_name_sub = str(self.entrySub.get()) #save users entry
  
  class B(A):
  
      def __init__(self, master):
         self.master = master
         A.csv_name_sub = str(self.entrySub.get())
         self.resultFile = open("/Users/Desktop/" + A.csv_name_sub +
                             '_results.csv', 'w') #use the users entry as the name of the csv file I save
  </code></pre>
  
  <p>But error tells me "AttributeError: 'B' object has no attribute 'entrySub'". Could you help me with that? Thanks!!</p>