title: Cannot overwrite object attributes within associated object
body: <p>I'm having a controller class that has some attributes. The attributes in this class might sometimes have to be overwritten with the values stored in a database. Unfortunately, I came across an issue that addresses a pretty fundamental thing in OOP I guess so I would really like to understand what I'am doing wrong instead writing an workaround.</p>
  
  <p>My real code is of course much bigger but the next simplification should really show the problem.</p>
  
  <pre><code>class Project():
      def __init__(self):
          self.beams = 10
  
  class Controller():
      def __init__(self):
           self.project = Project()
  
      def proc(self):
          self.r = Register(self.project)
          self.r.load()
  
  class Register():
      def __init__(self, project):
           self.project = project
  
      def load(self):
          p2 = Project()
          p2.beams = 5
  
          self.project = p2
          # self.project.beams = 4
  
  c = Controller()
  print(c.project.beams)
  
  c.proc()
  c.r.load()
  
  print(c.project.beams)
  </code></pre>
  
  <p>Expected results:</p>
  
  <pre><code>10
  5
  </code></pre>
  
  <p>What I'm getting:</p>
  
  <pre><code>10
  10
  </code></pre>
  
  <p>Note that when I use the commented line <code>self.project.beams = 4</code> line, the results are:</p>
  
  <pre><code>10
  4
  </code></pre>
  
  <p>Apparently, I cannot overwrite the <code>project</code> attribute in the register class, but why not?</p>