title: Cannot access class variable outside class - kivy
body: <p>Anytime i try to run my app i get error.</p>
  
  <p>Error: AttributeError: 'NoneType' object has no attribute 'text'</p>
  
  <p>See code snippet below              </p>
  
  <pre><code>class Login(Screen):
  
      email_obj = ObjectProperty()
      password_obj = ObjectProperty()
      conn = lite.connect("database/nairamanager.db")
      cursor = conn.cursor()
  
      def init(self, **kwargs):
          super().__init__(**kwargs)
  
      # Display an alert on login validation
      def login_alert(self):
          p = LoginAlert()
          p.open()
  
      # Get user from database
      def login_nm_user(self):
          self.cursor.execute("SELECT * FROM user_tb WHERE email_db = ? AND password_db = ?;", (self.email_obj.text, self.password_obj.text))
          if self.cursor.fetchall():
              self.manager.current = "news_feed_screen"
          else:
              return self.login_alert()
              self.conn.commit()
              # self.conn.close
  
      # Get user email
      def get_user_email(self):
          self.cursor.execute("SELECT * FROM user_tb WHERE email_db = ?;", (self.email_obj.text))
          self.user_email = self.cursor.fetchone()[0]
          self.conn.commit()
          print(self.user_email)
  
  
  login = Login()
  login.get_user_email()
  print(login.user_email)
  </code></pre>
  
  <p>.kv code
  Below is the Login class in the kivy lang file</p>
  
  <pre><code>&lt;Login&gt;:
  
  email_obj: email_text
  password_obj: password_text
  
  
  GridLayout:
      size: root.size
      rows: 2
      rows_minimum: {0:0,1:root.height*.7}
      spacing: 50
      GridLayout:
          rows: 2
          row_default_minimum: True
          rows_minimum: {0:root.height*.1,1:root.height*.01}
          BoxLayout:
              orientation: "horizontal"
              BackButton:
                  text: "L"
                  size_hint: (.1,1)
                  halign: "center"
                  markup: True
                  on_press:
                      root.manager.current = "login_signup_screen"
                      root.manager.transition.direction = "left"
              TopLabel:
                  text: "[b]Lets get you logged in...[/b]"
                  size_hint: (.9,1)
          BorderLabel:
  
      # Login form
      BoxLayout:
          orientation: "vertical"
          spacing: 20
          UniTextInput:
              id: email_text
              hint_text: "Email"
              size_hint: (.6,1)
              pos_hint: {"center_x":.5}
          UniTextInput:
              id: password_text
              hint_text: "Password"
              password: True
              size_hint: (.6,1)
              pos_hint: {"center_x":.5}
          GreenButton
              id: main_login_button
              text: "Login"
              size_hint: (.6,1)
              pos_hint: {"center_x":.5}
              on_press:
                  root.login_nm_user()
                  root.get_user_email()
  
          # Fake widget for spacing
          Widget:
          Widget:
          Widget:
  </code></pre>
  
  <p>Please, how do i fix this?</p>