Micro Servo - python ,read/Write

Hey, this is probably a very dumb question for more experienced users, but i get this weird behavior.

My problem is this: When i run the script , the servo will execute 1 time, after that the .write function seem to disable itself?

So this is the PYTHON

import serial  # for Serial communication
import time  # for delay functions

arduino = serial.Serial('com9', 9600)  # Create Serial port object called arduinoSerialData
time.sleep(2)  # wait for 2 secounds for the communication to get established
print("")
print("Enter 1 to OPEN & 0 to CLOSE")
print("Type in number")
defence = 1
var = input().encode()  # get input from user

while 1:  # Do this in loop
    var = input().encode()
    print("Starter ny loop")
    if (var == b'1'):  # if the value is 1
        arduino.write(var)
        print("Opened")
        defence = 1
        time.sleep(1)
        arduino.flush()
    if (var == b'0'):  # if the value is 0
        arduino.write(var)  # send 0
        print("Closed")
        defence = 0
        time.sleep(1)
        arduino.flush()

So this is the Arduino code

#include <Servo.h>

Servo servoright;  // create servo object to control a servo
Servo servoleft;
int pos = 0;    // variable to store the servo position
int angle = 0;  // variable to change angle we need and start/stop servo movements

void setup() {
  Serial.begin(9600); // Using 9600 baud to have ability to send messages from Arduino 
  servoright.attach(9);  // attaches the servo on pin 9 to the servo object
  servoleft.attach(10);

  
  servoright.write(0);
  servoleft.write(90);
}

void loop() 
{
while (Serial.available())
  {
    angle = Serial.read();
  }


  delay(20);
  if (angle == '1') {
  servoright.write(90); 
  servoleft.write(0);
  Serial.println("Going to 90");
  }
  else if (angle == '0') {
  servoright.write(90);
  servoleft.write(0);
  Serial.println("Going back to 0");
  }

}

And the output in the python is this:

Enter 1 to OPEN & 0 to CLOSE
Type in number

1
Starter ny loop
Opened
0
Starter ny loop
Closed
1
Starter ny loop
Opened
0
Starter ny loop
Closed

Process finished with exit code -1
arduino = serial.Serial('com9', 9600)  # Create Serial port object called arduinoSerialData

When you have useless comments, you MUST make certain that the useless comment matches the code.

        defence = 1

The value in this variable is never used. Why does the variable exist? What is the point of assigning it a value?

    angle = Serial.read();

The value that you are reading is NOT an angle.

The Arduino writes to the serial port. The python script never reads from the serial port. The python script has a problem. Coincidence? I doubt it.