'Delay in serial response

I'm connecting to a device running on linux using serial port. The issue i'm having is the responses seem to not appear right away. For example instead of getting the prompt (aa@bb:~$) I get it after I send my command. Another example is I have Up Key triggered so that it returns the command history but it won't appear until I hit enter

Here is my code for

def checkSerialPort(self):
    global startup_flag, get_DeviceInfo
    if (serialInst.is_open):
        if serialInst.in_waiting:
            pos = str(int(mainWindow.text_box.index("end")[0])-1)+".1"
            # pos = str(int(mainWindow.text_box.index("end")[0])-1)
            packet_byte = serialInst.readline()
            packet_string = packet_byte.decode('utf-8')
            print(packet_string)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source