title: I have a python module and want to call all constants
body: <p>I have a Lego mindstorms 51515 and like to program it with python.</p>
  <p>There are some default image in the module I'd like to loop over and use.</p>
  <pre><code>import hub
  images = dir(hub.Image)
  print(images)
  </code></pre>
  <p>Output:</p>
  <pre><code>['__class__', '__name__', '__bases__', '__dict__', 'ALL_ARROWS', 'ALL_CLOCKS', 'ANGRY', 'ARROW_E', 'ARROW_N', 'ARROW_NE', 'ARROW_NW', 'ARROW_S', 'ARROW_SE', 'ARROW_SW', 'ARROW_W', 'ASLEEP', 'BUTTERFLY', 'CHESSBOARD', 'CLOCK1', 'CLOCK10', 'CLOCK11', 'CLOCK12', 'CLOCK2', 'CLOCK3', 'CLOCK4', 'CLOCK5', 'CLOCK6', 'CLOCK7', 'CLOCK8', 'CLOCK9', 'CONFUSED', 'COW', 'DIAMOND', 'DIAMOND_SMALL', 'DUCK', 'FABULOUS', 'GHOST', 'GIRAFFE', 'GO_DOWN', 'GO_LEFT', 'GO_RIGHT', 'GO_UP', 'HAPPY', 'HEART', 'HEART_SMALL', 'HOUSE', 'MEH', 'MUSIC_CROTCHET', 'MUSIC_QUAVER', 'MUSIC_QUAVERS', 'NO', 'PACMAN', 'PITCHFORK', 'RABBIT', 'ROLLERSKATE', 'SAD', 'SILLY', 'SKULL', 'SMILE', 'SNAKE', 'SQUARE', 'SQUARE_SMALL', 'STICKFIGURE', 'SURPRISED', 'SWORD', 'TARGET', 'TORTOISE', 'TRIANGLE', 'TRIANGLE_LEFT', 'TSHIRT', 'UMBRELLA', 'XMAS', 'YES', 'get_pixel', 'height', 'set_pixel', 'shift_down', 'shift_left', 'shift_right', 'shift_up', 'width']
  </code></pre>
  <p>All the full names that have only upper case letter should be constants I would like to loop over.</p>
  <p>How to do this?</p>
  <pre><code>for dynamic_image in images:
      if not dynamic_image.isupper():
          continue
      var = hub.Image.{dynamic_image} # This is the real question on how to do this
  </code></pre>