title: Python Type is not defined
body: <p>I want to do the semantic checking for a language and i use ANTLR4 to generate parser and visitor class. However i met a problem.
  If i use this method <code>print(type(newList[0].expression()))</code><br>
  I will get a type like this <code>&lt;class 'IDILParser.IDILParser.IdenetExpressionContext'&gt;</code><br>
  However, if i run the code below, i will get a error like this <code>NameError: name 'IDILParser' is not defined</code><br>
  Can i ask how to fix this problem? Thanks!</p>
  
  <pre><code>from antlr4 import *
  if __name__ is not None and "." in __name__:    
      from .IDILParser import IDILParser
  else:
      from IDILParser import IDILParser
  
  class IDILVisitor(ParseTreeVisitor):
      def visitAssign(self, ctx:IDILParser.AssignContext):
          if type(newList[0].expression()) is IDILParser.IDILParser.IdenetExpressionContext:
          ...
  </code></pre>