title: How to circumvent 'name already defined error' in mypy?
body: <p>So I'm doing type annotations on some code. And this code follows the following convention.</p>
  <p>I have some kind of base module that defines certain classes</p>
  <pre><code>#module1.py
  class A():
    attr1 = 'hello'
    attr2 = 'world'
  
  class B():
    attr3 = 'hi'
    attr4 = 'earth'
  </code></pre>
  <p>And then in some other modules, I import and inherit from them and override some of the attributes.</p>
  <pre><code>#module2.py
  from module1 import *
  class A(A):
    attr1 = 'bye'
  
  class B(B):
    attr3 = 'goodbye'
  </code></pre>
  <p>When I run mypy against this, it will have the following error: <code>Name 'A' already defined (possibly by an import)</code></p>
  <p>Is there any way I can go about fixing this without adding <code># type: ignore</code> to each instance of this error that comes up in mypy? The only other solution I could think of is to rename the base class, e.g. <code>class ABase():</code>, but that is not possible. Because in some modules, A will not be overwritten but I still need access to A from that module. E.g. module3 might be</p>
  <pre><code>from module1 import *
  class B(B):
    attr3 = 'something'
  </code></pre>
  <p>So here, I don't override A, but I still need to be able to access <code>module3.A.attr1</code>, which is not possible if I rename the base class. Is this possible, or should I just resort to ignoring all the errors. And if so, is there a single configuration setting I can add to my mypy.ini? I couldn't find any <a href="https://mypy.readthedocs.io/en/stable/config_file.html#inverting-option-values" rel="nofollow noreferrer">here</a>.</p>