title: micropython: loading data from a file in function causing an endless loop
body: <p>I am working on a lopy4 from pycom and I have encountered an od problem while loading config data from a txt file:</p>
  <pre><code>def loadFromConfigFile():
      f= open('config.txt')
      for line in f:
          if &quot;uuidExpected&quot; in line:
              uuidExpected=line[13:len(line)-1].strip()
          elif &quot;app_eui&quot; in line:
              app_eui = ubinascii.unhexlify((line[8:len(line)-1]).strip())
          elif &quot;app_key&quot; in line:
              app_key = ubinascii.unhexlify((line[8:len(line)-1]).strip())
          elif &quot;syncClockTime&quot; in line:
              syncClockTime=float(line[14:len(line)-1].strip())
          elif &quot;loraJoinTime&quot; in line:
              loraJoinTime=float(line[13:len(line)-1].strip())
          elif &quot;bleScanInterval&quot; in line:
              bleScanInterval=int(line[16:len(line)-1].strip())
          elif &quot;mainLoopWaitTime&quot; in line:
              mainLoopWaitTime=int(line[17:len(line)-1].strip())
          elif &quot;hbInterval&quot; in line:
              hbInterval=int(line[11:len(line)-1].strip())
      f.close()
  
  loadFromConfigFile()
  </code></pre>
  <p>When I use this function my programme gets stuck here:</p>
  <pre><code>lora.join(activation=LoRa.OTAA, auth=(app_eui, app_key), timeout=0)
  while not lora.has_joined():
      time.sleep(loraJoinTime)
      print('Not yet joined...')
  print(&quot;joined!&quot;)    
  setClock()
  </code></pre>
  <p>The sleep function doesn't work and the print function spams &quot;Not yet joined...&quot; in the terminal window.</p>
  <pre><code>f= open('config.txt')
  for line in f:
      if &quot;uuidExpected&quot; in line:
          uuidExpected=line[13:len(line)-1].strip()
      elif &quot;app_eui&quot; in line:
          app_eui = ubinascii.unhexlify((line[8:len(line)-1]).strip())
      elif &quot;app_key&quot; in line:
          app_key = ubinascii.unhexlify((line[8:len(line)-1]).strip())
      elif &quot;syncClockTime&quot; in line:
          syncClockTime=float(line[14:len(line)-1].strip())
      elif &quot;loraJoinTime&quot; in line:
          loraJoinTime=float(line[13:len(line)-1].strip())
      elif &quot;bleScanInterval&quot; in line:
          bleScanInterval=int(line[16:len(line)-1].strip())
      elif &quot;mainLoopWaitTime&quot; in line:
          mainLoopWaitTime=int(line[17:len(line)-1].strip())
      elif &quot;hbInterval&quot; in line:
          hbInterval=int(line[11:len(line)-1].strip())
  f.close()
  </code></pre>
  <p>When I don't wrap this code into a function everything works. When I write the function after the hardcoded loop everything works as well.</p>