title: Rock, Paper, Scissors. Udacity, Classes and Subclasses
body: <p>I'm getting this error:</p>
  
  <pre><code>move1 = self.p1.move()
  &gt; AttributeError: 'str' object has no attribute 'move'
  </code></pre>
  
  <p>Basically I'm trying to understand how to call a module from one Class. The Player or RandomPlayer Class. From the Game Class.</p>
  
  <p>Here is some of the code:</p>
  
  <pre><code>moves = ['rock', 'paper', 'scissors']
  class Player():
      def move(self):
          return 'rock'
  
      def __init__(self, p1, p2):
          self.p1 = p1
          self.p2 = p2    
  
  class RandomPlayer(Player):  
      def move(self):
          p1 = random.choice(moves)
          p2 = random.choice(moves)
          return (p1, p2) 
  
  class Game():
  
      def __init__(self, p1, p2):
        self.p1 = p1
        self.p2 = p2
  
      def play_round(self, p1, p2):
          move1 = self.p1.move()
          move2 = self.p2.move()
          print(f"Player 1: {move1}  Player 2: {move2}")
          self.p1.learn(move1, move2)
          self.p2.learn(move2, move1)
          return (move1,move2)
  </code></pre>