title: AttributeError: 'module' object has no attribute
body: <p>I've been scouring the internet for a solution and everything i've come across hasn't helped. So now i turn to you.</p>
  
  <pre><code>Traceback (most recent call last):
    File "cardreader.py", line 9, in &lt;module&gt;
      import ATRdb as ATR
    File "/home/pi/Desktop/CardReader/ATRdb.py", line 4, in &lt;module&gt;
      import cardreader
    File "/home/pi/Desktop/CardReader/cardreader.py", line 113, in &lt;module&gt;
      main()
    File "/home/pi/Desktop/CardReader/cardreader.py", line 40, in main
      getData(db)
    File "/home/pi/Desktop/CardReader/cardreader.py", line 98, in getData
      if ATR.checkPerms(db,track1):
  AttributeError: 'module' object has no attribute 'checkPerms'
  </code></pre>
  
  <p>I have two files cardreader.py &amp; ATRdb.py</p>
  
  <p>---ATRdb.py has this setup</p>
  
  <pre><code>import sys
  import MYSQLdb
  import datetime
  import cardreader
  
  def checkPerms(db, securitycode):
      try:
         cursor = db.cursor()
         cursor.execute("""SELECT permissions FROM atrsecurity.employee WHERE securitycode = %s""", (securitycode))
         r = cursor.fetchone()
         Permissions = r
         if '3' in Permissions[0]:
            return True
         else:
            return False
       except Exception:
           cardreader.main()
           return False
  </code></pre>
  
  <p>---cardreader.py has this setup</p>
  
  <pre><code>import sys
  import usb.core
  import usb.util
  import MYSQLdb
  import ATRdb as ATR
  
  def main():
      db = MYSQLdb.connect(HOST,USER, PASS, DB)
      print("Please swipe your card...")
      getData(db)
      main()
      db.close()
  def getData(db):
      #
      #lots of code to get card data
      #
      if ATR.checkPerms(db, track1):
         print ("User has permission")
         unlockDoor()
  </code></pre>
  
  <p>i get the error at the "If ATR.checkPerms():" part. Any help would be appreciated 
  (first python project)</p>