title: Cannot import local module in Python despite trying multiple suggestions
body: <p>I've read through about ten posts on how to import local modules, and I'm still stumped on why this isn't working. I have an extremely simple module, actor.py, with a single class inside it:</p>
  
  <pre><code>class Actor(object):
      def __init__(self, name, age):
          self.name = name
          self.age = age
  </code></pre>
  
  <p>I'm trying to import it into another module, scraper.py, within the same directory:
  <a href="https://i.stack.imgur.com/5Zft3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5Zft3.png" alt="enter image description here"></a></p>
  
  <p>Some fixes have listed not having <strong>init</strong>.py as being a problem with local imports, so I know that's not my problem.
  Initially I tried these:</p>
  
  <pre><code>import actor
  </code></pre>
  
  <p>and</p>
  
  <pre><code>from actor import Actor
  </code></pre>
  
  <p>but it tells me that actor and Actor are unresolved references. <a href="https://stackoverflow.com/questions/4142151/how-to-import-the-class-within-the-same-directory-or-sub-directory">here</a> tells me that's Python 2 syntax, and I'm using Python 3. That answer instead recommends that I do:</p>
  
  <pre><code>from .actor import Actor
  </code></pre>
  
  <p>When I run my program with that syntax, I get this error:</p>
  
  <pre><code>ModuleNotFoundError: No module named '__main__.actor'; '__main__' is not a package
  </code></pre>
  
  <p>So I go searching again, and <a href="https://stackoverflow.com/questions/41816973/modulenotfounderror-what-does-it-mean-main-is-not-a-package">this</a> post tells me to remove the dot from 'actor,' but as stated before, I've tried that as well. My final guess was</p>
  
  <pre><code>from . import actor
  </code></pre>
  
  <p>but that yields</p>
  
  <pre><code>ImportError: cannot import name 'actor'
  </code></pre>
  
  <p>which I follow to <a href="https://stackoverflow.com/questions/9252543/importerror-cannot-import-name-x">here</a>, but the answers there mention circular dependencies, and I'm certain actor and scraper have none. Am I perhaps not writing my module correctly? I can't think of any other ways to write an import statement.</p>
  
  <p>edit: if it helps at all, I'm using Intellij</p>