title: Scala - object X is not member of package Y
body: <p>I have the following two files:</p>
  
  <p><strong>MainObject.scala</strong></p>
  
  <pre><code>import mypkg.MyObject._  
  object MainObject {}
  </code></pre>
  
  <p><strong>mypkg/MyObject.scala</strong></p>
  
  <pre><code>package mypkg  
  object MyObject {}
  </code></pre>
  
  <p>Then when I try to compile with <code>scalac MainObject.scala</code> I get the error</p>
  
  <blockquote>
    <p>MainObject.scala:1: error: object MyObject is not a member of package
    mypkg</p>
  </blockquote>
  
  <p>Any idea as to why this error would occur?</p>