title: Removing elements from list and importing list into another code
body: <p>I'm trying to list all the html files in a single directory which works fine. However I'm trying to remove everything that is not a html file from that list as well.</p>
  
  <p>i have 8 files called 1, 2, 3... etc. and 6.htmxl (remove) and pipe.sh.save(remove)</p>
  
  <p>The code I made removes the .htmxl file but does not remove the .sh.save file from the list.</p>
  
  <pre><code>from os import listdir
  from os.path import isfile, join
  import pyimport
  import time
  
  
  def main():
      onlyfiles = [f for f in listdir('/home/pi/keyboard/html') if isfile(join('/home/pi/keyboard/html',f)) ]
      j = 0
      print len(onlyfiles)
  
      for i in onlyfiles:
  
              if i.find(".html") == -1:
                      print i
                      print  "not a html"
                      j = onlyfiles.index(i)
                      print j
                      del onlyfiles[j]
              else:
                      print i
                      print "html found"
  
              time.sleep(0.5)
  
      outfiles = onlyfiles
      print outfiles
      return outfiles
  
  if __name__ == "__main__":
      main()
  </code></pre>
  
  <p>I also have another code which is suppose to get the "outfiles" list</p>
  
  <pre><code>import server_handler
  
  files = server_handler.main()
  
  fileList = server_handler.outfiles
  </code></pre>
  
  <p>But when I run it I get:</p>
  
  <pre><code>AttributeError: 'module' object has no attribute 'outfiles'
  </code></pre>
  
  <p>I'm running nearly the exact same code on another code which is creating 'output' and I import it in the exact same way so I'm not sure why its not importing correctly.</p>