Trying to get simple communication over COM port

I am trying to have a python script run on a RPi to communicate with my Arduino to change the color of a light strip. The code is pretty simple, so not a whole lot should be going wrong...

#include <FastLED.h>

#define NUM_LEDS 360
#define LED_PIN 6

CRGB led[NUM_LEDS];

void setup() {
  // put your setup code here, to run once:
  FastLED.addLeds<NEOPIXEL, LED_PIN>(led, NUM_LEDS);
  Serial.begin(9600);
  
}

void loop() {
  if (Serial.available()){
    if(Serial.read() == 'I'){
      rainbow_wave(40, 10);
      FastLED.show();
    } else if (Serial.read() == 'R'){
      static_red();
      FastLED.show();
    } else if (Serial.read() == 'P'){
      static_purple();
      FastLED.show();
    } else if (Serial.read() == 'O'){
      off();
      FastLED.show();
    }
  }
}

//rainbow_wave(40, 10);                                      // Speed, delta hue values.
void rainbow_wave(uint8_t thisSpeed, uint8_t deltaHue) {     // The fill_rainbow call doesn't support brightness levels. 
  uint8_t thisHue = beat8(thisSpeed,255);                    // A simple rainbow march.
  fill_rainbow(led, NUM_LEDS, thisHue, deltaHue);            // Use FastLED's fill_rainbow routine.
}

void static_red(){
  for (int i = 0; i < NUM_LEDS; i++){
    led[i] = CRGB(255, 0, 0);
  }
}

void static_purple(){
  for (int i = 0; i < NUM_LEDS; i++){
    led[i] = CRGB(155, 0, 255);
  }
}

void off(){
  for (int i = 0; i < NUM_LEDS; i++){
    led[i] = CRGB(0, 0, 0);
  }
}

Then here is just a simple python script I am using to test out the serial communication:

import serial

ser = serial.Serial("COM4", 9600)
ser.write(b'I')

Small addition: I added a "pause" while the serial connection is opened, and this appeared to work but after the LED strip is turned on, it won't change and will freeze the way it is. Ex: can't send a command for turning off or changing the color like intended.
Also: The rainbow function works when running rainbow_wave(40, 10) in void loop(), but will freeze when ran in the "if" statement

are you trying to communicate with the arduino using pins 1 & 2 while you have the arduino IDE open which uses the same interface?

Negative, it appears I have to have a delay when the serial port is opened with the second script so that the Arduino can actually read what is written, that issue is resolved but I got anotha

Yes, whenever you open the serial port, the arduino actually resets and takes a few seconds to run setup() again which initializes the serial port. If you don't want this behavior, there is a small trace you can cut on the arduino board to prevent this reset. Be warned, it also prevents the IDE from uploading code since it uses that mechanism as part of the upload process. If you go down this route, it is much better to cut the trace and install a switch so you can toggle the behavior.

You're re-reading the serial port multiple times, once for each comparison, and the non-initial reads probably return -1 since no new data will have arrived so rapidly.
You probably want:

if (Serial.available()){
    int command = Serial.read();
    if(command == 'I'){
      rainbow_wave(40, 10);
      FastLED.show();
    } else if (command == 'R'){
      static_red();
      FastLED.show();
    }
    ...