title: How to create an object in runtime and save its reference name in a list
body: <p>I have created a class called 'runtime' and I want to create several instances of this class in runtime</p>
  <pre><code>class runtime:
      products = []
      number_of_objects = 0
      max_objects = 10
  
      def __init__(self, name):
          self.name = name
          print(self.name)
          runtime.number_of_objects += 1
  
      def get_name(self):
          return self.name
  
      @classmethod
      def list_of_products(cls):
          for i in cls.products:
              print(i)
  
  while (True):
      print(&quot;1 create&quot;)
      print(&quot;2 view&quot;)
      print(&quot;3 delete&quot;)
  
      operation = input(&quot;enter your choice:&quot;)
  
      if int(operation) == 1:
          nick_name = input(&quot;enter nickname of the product:&quot;)
          runtime.products.append(nick_name)
          nick_name = runtime(nick_name)
  
      elif int(operation) == 2:
          runtime.list_of_products()
          runtime.products[0].get_name()
  
      elif int(operation) == 3:
          pass
  
      else:
          print(&quot;choice unknown&quot;)
  </code></pre>
  <p>but however, during the view operation when I try to get the name of an instance that I have created I get the error:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;runtime objects.py&quot;, line 34, in &lt;module&gt;
      eval(runtime.products[0]).get_name()
    File &quot;&lt;string&gt;&quot;, line 1, in &lt;module&gt;
  NameError: name 'object1' is not defined
  </code></pre>
  <p>when I omit the eval() function it returns AttributeError</p>