title: How to load only one class from module?
body: <p>I have code:</p>
  
  <pre><code>mod_file = 'mymod.py'
  mod_path = os.path.join('.', mod_file)
  mod_py = 'mymod'
  mod = imp.load_source(mod_py, mod_path)
  if hasattr(mod, 'MyClass'):
      instance = py_mod.MyClass()
  </code></pre>
  
  <p>mymod.py:</p>
  
  <pre><code>class MyClass():
  
      def __init__(self):
          print 'Hello'
      [...]
  
  print 'something'
  a = MyClass()
  </code></pre>
  
  <p>But "imp.load_source" execute all instructions from this file. I want only get class MyClass - and other thigns skip. How to do it?</p>
  
  <p>Edit:</p>
  
  <p>I can not interfere in the "mymod.py" file, and I do not know how the file will be named, this is example.</p>
  
  <p>I know that in the file will be class 'MyClass'. Other things are undesirable.</p>