title: Python mistakes a function for an undefined variable
body: <p>So, it says that <code>create</code> in line 11 is not defined, but it is a recursive function within the class. And In VS Code, it shows me an error at line 6 - it says that I am missing the <code>self</code> argument, but when I add it, it requires 3 arguments in line 23 (why, I can't provide an argument for <code>self</code>, can I ?) </p>
  
  <p>I already tried it with various variations of adding <code>self</code> to the arguments, but nothing worked.</p>
  
  <pre class="lang-py prettyprint-override"><code>class smarray:
      def __init__ (self):
  
          self.array = []
  
      def create(index, dim):
          array1 = []
          if index &lt; len(dim)-1:
              for x in range(0,dim[index]):
  
                  array1.append((create(index+1,dim)))
  
              return array1
          else:
              for x in range(0,dim[index]):
                  array1.append("nul")
              return array1
          if index ==0:
              self.array = array1
  
  t = smarray()
  
  t = smarray.create(0, [3,4])
  </code></pre>
  
  <p><strong>error TB:</strong></p>
  
  <pre><code>Traceback (most recent call last):
    File "/Users/pc/Documents/VS Code Files/Python testing/testing range.py", line 23, in &lt;module&gt;
      t = smarray.create(0, [3,4])
    File "/Users/pc/Documents/VS Code Files/Python testing/testing range.py", line 11, in create
      array1.append((create(index+1,dim)))
  NameError: name 'create' is not defined
  </code></pre>