title: Created variable inside for loop can't be accessed when using a class
body: <p>The following code runs fine if I don't use an object oriented style</p>
  <pre><code>settings = &quot;test&quot;
  for i in range(3):
      globals()[f&quot;var{i + 1}&quot;] = 10 + i
      
  print(settings)
  print(var1)
  </code></pre>
  <p>it outputs the following:</p>
  <pre><code>test
  10
  </code></pre>
  <p>However when I use the same code inside a class it does not work anymore:</p>
  <pre><code>class Gui():
      def __init__(self):
          self.settings = &quot;test&quot;
          for i in range(3):
              globals()[f&quot;self.var{i + 1}&quot;] = 10 + i
  
  
      def run(self):
          print(self.settings)
          print(self.var1)
  
  gui = Gui()
  gui.run()
  </code></pre>
  <p>I get the following error:</p>
  <pre><code>test
  Traceback (most recent call last):
    File &quot;C:/Users/loose/PycharmProjects/AutomatedCNNImageClassifier/python/test.py&quot;, line 14, in &lt;module&gt;
      gui.run()
    File &quot;C:/Users/loose/PycharmProjects/AutomatedCNNImageClassifier/python/test.py&quot;, line 10, in run
      print(self.var1)
  AttributeError: 'Gui' object has no attribute 'var1'
  
  Process finished with exit code 1
  </code></pre>
  <p>Why does it not work? Since I want to access the variable <em>var</em> from another function I have to use <em>self.var</em> just like I did with <em>self.settings</em>.</p>