title: python className not defined NameError
body: <p>I have a class which i need to instantiate in order to call a method that it contains. When I access it from another class it works fine but when i run from terminal it says :  </p>
  
  <pre><code>File "myClass.py", line 5, in &lt;module&gt;
    class MyClass:
  File "myClass.py", line 23, in ToDict
    td=MyClass()
  NameError: name 'MyClass' is not defined
  </code></pre>
  
  <p>Pasting the code: </p>
  
  <pre><code>class MyClass:
      def convert(self, fl):
          xpD = {}
          # process some stuff
          return xpD
  
      if __name__ == "__main__":
          source = sys.argv[1]
          td = MyClass()
          needed_stuff = td.convert(source)
          print(needed_stuff)
  </code></pre>