title: Passing Custom Class in Python
body: <p>I'm passing a set of <code>MovieFile</code> objects from x.py to y.py and iterating through them, trying to use each object's attributes in y.py</p>
  
  <p><strong>x.py</strong></p>
  
  <pre><code>mfSet = {}
  
  def pop():
      ## populate mfSet with MovieFile objects
      m = MovieFile(title=t, year=y, dir=d, filename=f)
      mfSet.setdefault(str(m), []).append(m)
  
  class MovieFile():
      def __init__(self, title, dir, filename, year=0):
          self.title = title
          self.year = year
          self.fulltitle = title if year == 0 else title + ' (' + year + ')'
          self.dir = dir
          self.filename = filename
      def __str__(self):
          return repr(self.title + ' (' + self.year + ') at ' + self.dir)
  </code></pre>
  
  <p><strong>y.py</strong></p>
  
  <pre><code>from x import MovieFile, mfSet, pop # not sure if I need to import MovieFile
  
  pop()
  
  for mf in mfSet:
      ft = mf.fulltitle # stacktrace says this attr doesn't exist for str object
      title = mf.title # printing shows that this is "&lt;built-in method title of str object at 0x10d84a3f0&gt;"
  </code></pre>
  
  <p>So my main questions are:</p>
  
  <p>Why are the MovieFile objects compiling as str objects, and how can I use the <code>fulltitle</code> attr once I get use of those objects?</p>