title: Is there a way to turn a string into a usable object?
body: <p>So I am creating a program that has different possible string outputs. For example, the outputs could either be &quot;a&quot;, &quot;b&quot;, or &quot;c&quot;. However I want to be able to use these outputs as an object. I already have objects initialized as a b and c.  For example:</p>
  <pre><code>class Letter:
    pass
  
  a = Letter()
  b = Letter()
  c = Letter()
  
  output = random.choice([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;])
  
  #for example it would output &quot;a&quot;
  #then I would &quot;call&quot; (lack of a better term) the a object to do something with it
  #basically the output decides which object I would use
  
  a.color = &quot;green&quot;
  </code></pre>