Solved: It seems that after instantiating the class which opens the port, it takes approximately 1 second for the board to boot up before data can be wrote. I'm uncertain if there is any way around this though.
Original Question: I have a basic script that sends G-Code to an Einsy Retro printer controller board via USB type-B which turns a stepper motor. It works fine, but only if I force a delay of 909 milliseconds between the moment that I instantiate a serial object and when I write the G-Code to the board. I used time.sleep() to make the program wait, and any delay less than 909 milliseconds would cause the motor not to rotate. I confirmed this on two separate computers.
Here is the code that I'm using:
from serial import Serial
import time
_serial = Serial(str('COM3'), 115200, timeout=3, writeTimeout=3) # Instantiate Serial class
time.sleep(0.909) # 909 millisecond delay
_serial.write(b'G1 X300\n') # Write the GCode to the board