NameError: name 'form' is not defined (Python3)
<p>Basically the <code>main</code> method takes user input, checks it and calls the <code>first</code> method if the user doesn't enter <code>quit</code>.</p>

<p>The <code>first</code> method checks the first section of the input and calls one of the other methods depending on what the user enters. This is the point I get an error; when the <code>first</code> method calls the <code>form</code> method, for example, I get an <code>NameError: name 'form' is not defined</code> exception. I'm a little confused about this since I've defined each method and they're all spelt correctly, also when I call the <code>quit</code> method it works perfectly fine.</p>

<p>Main method: </p>

<pre><code>if __name__ == '__main__':
        for line in sys.stdin:
                s = line.strip()
                if not s: break
                if (str(s) == "quit"): quit()
                elif (str(s) == "quit") == False:
                        a = s.split()
                        print(a)
                        if (len(a) is 2): first(a)
                        elif (len(a) is 3): first(a)
                        else: print("Invalid Input. Please Re-enter.")
</code></pre>

<p>First method:</p>

<pre><code>def first(a = list()):
        word = a[0]

        if word == "ls":
                ls(a[1])           
        elif word == "format":
                form(a[1])
        elif word == "reconnect":
                reconnect(a[1])
        elif word == "mkfile":
                mkfile(a[1])
        elif word == "mkdir":
                mkdir(a[1])
        elif word == "append":
                append(a[1], a[2])                               
        elif word == "delfile":
                delfile(a[1])
        elif word == "deldir":
                deldir(a[1])
        else:
                print("Invalid Prompt. Please Re-enter.")
</code></pre>

<p>Other methods (these are all called from the first method):</p>

<pre><code>def reconnect(one = ""):
        print("Reconnect")

def ls(one = ""):
        print("list")

def mkfile(one = ""):
        print("make file")

def mkdir(one = ""):
        print("make drive")

def append(one = "", two = ""):
        print("append")

def form(one = ""):
        print("format " + one)

def delfile(one = ""):
        print("delete file")

def deldir(one = ""):
        print("delete directory")

def quit():
        print("quit")
        sys.exit(0)
</code></pre>