Below is some code i am using to pull out some serial data from an arduino. This IF statement if (Ardinput == stagecode): Is not using the global variable declared earlier in the same function. I know its something with my logic i just not sure what.

EDIT I added all my code to help clear things up

```
stagecode = "STAGE "

ser = serial.Serial(
port='COM3',
baudrate=9600, 
)

def stage():
            urllib.request.urlopen(url + 'f.stage')

def capture():
    global Ardinput
    print ("Start capture")

    while (1):           
            line = ser.readline()
            if (line != ""):
               print (line)
               Ardinput = line
               Ardinput = Ardinput.decode("utf-8")
               print (Ardinput + ' Befor CR')
               Ardinput = Ardinput[:-1]
               print (Ardinput)
               done = Ardinput
               break
if (Ardinput == stagecode):       
    print (stagecode + ' IN IF FUNCTION')
    #stage()

print ("Start Application" + Ardinput  )
print

capture()

```