title: How to get class object from class name string in the same module?
body: <p>I have a class</p>
  <pre><code>class Foo():
      def some_method():
          pass
  </code></pre>
  <p>And another class <strong>in the same module</strong>:</p>
  <pre><code>class Bar():
      def some_other_method():
          class_name = &quot;Foo&quot;
          # Can I access the class Foo above using the string &quot;Foo&quot;?
  </code></pre>
  <p>I want to be able to access the <code>Foo</code> class using the string &quot;Foo&quot;.</p>
  <p>I can do this if I'm in another module by using:</p>
  <pre><code>from project import foo_module
  foo_class = getattr(foo_module, &quot;Foo&quot;)
  </code></pre>
  <p>Can I do the same sort of thing in the same module?</p>
  <p>The guys in <a href="https://en.wikipedia.org/wiki/Internet_Relay_Chat" rel="noreferrer">IRC</a> suggested I use a mapping dict that maps string class names to the classes, but I don't want to do that if there's an easier way.</p>