title: I cannot call the "server" method from the socket connection to receive messages on another function on KIVYMD
body: <p>I'am using KIVYMD to connect to a labview server that sends data to my local ipaddress,
  I am using TextFields to connect to this server and it works, everytime i press the &quot;Receive &quot; button which is suposed to receive the data it just crashes with the</p>
  <p>&quot;msg = server.recv(1024)
  NameError: name 'server' is not defined&quot;</p>
  <p>My python mainfile</p>
  <pre><code>import socket
  from kivy.lang import Builder
  from kivymd.app import MDApp
  import socket
  import threading
  from kivy.clock import Clock
  
  class CGuiApp(MDApp):
      def build(self):
          self.theme_cls.theme_style = 'Dark'
  
      def connect(self):
          try:
              address = self.root.ids.ip.text
              data = self.root.ids.port.text
              port = int(data)
              server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
              server.connect((address, port))
              print(f'Connected to {address, port}')
              return server
          except :
              print('Couldnt connect to server')
  
      def receive(self):
          msg = server.recv(1024)
          print(msg.decode('utf-8'))
  
  if __name__ == '__main__':
      CGuiApp().run()
      server = CGuiApp().connect()
  </code></pre>
  <p>MY Kv file</p>
  <pre><code>MDScreen:
      MDBoxLayout:
          orientation: 'vertical'
          padding: 40
  
          MDTextField:
              hint_text: 'Ip'
              id: ip
              text:''
  
          MDTextField:
              hint_text: 'Port'
              id: port
              text:' 6486'
  
          MDRectangleFlatButton:
              text: 'Connect'
              on_release: app.connect()
  
          MDRectangleFlatButton:
              text: 'Receive'
              on_release: app.receive()
  
          MDLabel:
              id: label
              text: ''
  </code></pre>
  <p>Any help will be apreciated thanks!!</p>