title: Can't call list from within class.
body: <p>When I run the code I get the error message:
  "AttributeError: type object 'Player' has no attribute 'hkslist'"</p>
  
  <p>Why can't I call the list from within the class? The Idea is that the list is supposed to choose one of two of the functions from within the list and then run that once it's called upon. </p>
  
  <p>Full code:</p>
  
  <pre><code>import random
      from time import *
  
  
      class Colors:
          HEADER = '\033[95m'
          OKBLUE = '\033[94m'
          OKGREEN = '\033[92m'
          WARNING = '\033[93m'
          FAIL = '\033[91m'
          ENDC = '\033[0m'
          BOLD = '\033[1m'
          UNDERLINE = '\033[4m'
  
  
      class Player:
          coins = 100
          health = 100
          p = 3 #Potions
          hoursslept = 0
  
          def __init__(self): 
              random.seed()
              print("init instance variables here")
              #self.coins = random.randint(100, 500) Förlegad kod.
  
              def hk1():
                  print("Du sprang iväg")
  
              def hk2():
                  #print("Du försökte springa iväg men trillade och slog i knät: - 20 HP")
                  print("Du sprang iväg")
                  sleep(3)
                  print("men du trillar och slår i knät: -20 HP")
                  self.health = self.health - 20
                  print("Your health is: " + str(self.health), " HP")
                  #Fortsätt 'storyn'
  
              def hkf1():
                  print("Du besegrade håkan")
                  print("Du tar hans droger och säljer det själv till Eleverna: +150 coins")
                  print("Your health is ", str(self.health), " HP")
                  self.coins = self.coins + 150
                  print("You have: ", str(self.coins), " coins")
  
              def hkf2():
                  print("Håkan besegrade dig: -50 HP")
                  print("Your health is ", str(self.health), " HP")
                  print("You have: ", str(self.coins), " coins")
                  self.coins = self.coins + 150
              self.hkslist = [hk1, hk2]
              self.hkflist = [hkf1, hkf2]
              self.indhks = random.randint(0,len(self.hkslist)-1)
              self.indhkf = random.randint(0,len(self.hkflist)-1)
  
          def report_status(self):
              status_message = "Your health is %s, \nCoins left %s" % (self.health, self.coins)
              return status_message
  
  
      william = Player()
      hakan = Player()
  
      print("Welcome to a poorly made text-based game:")
      print("you have ", william.p, " potions")
      print("Your health is ", str(william.health), " HP")
      print("You have: ", str(william.coins), " coins")
  
      while True:
          print("Commands: add, drink, coins, sleep, quest")
          a = input("Enter a command: ")
          if a == "add" or a == "Add" or a == "buy" or a == "Buy":
              if william.coins == 0:
                  print("You can't afford a potion")
              else:
                  william.coins = william.coins - 25
                  william.p = Player.p + 1
                  print("You bought a potion for 25 coins")
                  print("You have ", william.coins, " coins left")
                  print("you have ", william.p, " potions")
                  print("Your health is now ", str(william.health), " HP")
          if a == "drink":
              if Player.p == 0:
                  print("You can't drink any potions.")
                  print("You have zero potions left!")
                  print("Your health is ", str(william.health), " HP")
              elif william.health &gt;= 250:
                  print("Your health is already maxed out. You can't drink a potion.")
                  print("you have ", str(william.p), " potions")
                  print("Your health is ", str(william.health), " HP")
              else:
                  william.health = william.health + 20
                  william.p = william.p - 1
                  print("you have ", william.p, " potions")
                  print("Your health is ", str(william.health), " HP")
          if a == "sleep":
              if william.health &gt;= 250:
                  print("Your health is already maxed out. You can't drink a potion.")
                  print("Your health is ", str(william.health), " HP")
              else:
                  william.health = william.health + 5
                  print("you have ", str(william.p), " potions")
                  print("Your health is ", str(william.health), " HP")
          if a == "I" or a == "i" or a == "inv" or a == "inventory":
              if william.p == 0:
                  print("Your backpack is empty")
              else:
                  print("you have ", str(william.p), " potions")
                  print("Your health is ", str(william.health), " HP")
          if a == "quest":
              quest = input("Choose from quest: 1, 2 or 3 ")
              if quest == "1" or quest == "option 1" or quest == "opt 1":
                  print("Du vandrar runt på Rudbeck när du ser Håkan, din samhällslärare, i ett mörkt hörn")
                  print("Du väljer att gå närmare för att investigera.")
                  print("Håkan står och säljer knark till eleverna.")
                  hk = input("Vad gör du? Spring: Slåss:")
                  if hk == "Spring" or hk == "spring":
                      Player.hkslist[Player.indhks]()
                  if hk == "slåss" or hk == "Slåss" or hk == "s":
                      Player.hkflist[Player.indhkf]()
          if a == "coins":
              if william.coins &gt;= 500:
                  print("You're filthy rich!!!")
                  print("You have: ", str(william.coins), " Coins")
              else:
                  print("You have: ", str(william.coins), " Coins")
      #Debug tools
  
          if a == "add coin" or a == "AC" or a == "ac" or a == "more":
              extracoins = input("How many coins do you want?: ")
              Player.coins = int(extracoins)
              print("You now have: ", str(william.coins), " Coins")
  </code></pre>