Input() called in a thread, and it blocked the main thread if the main thread called input()

hi experts,
what i want to do in my program is to listen to the input from the keyboard while the main thread is running.
my solution is to create a thread to listen to the input.
while True:
keyboard_input = input()
# some logic after the input detected.

meanwhile in the main thread, in some cases, i need the user input something from the keyboard either.
yes_or_no = input(“Do you want … (y/n)”)

when the program runs to the yes_or_no, it will be blocked by the keyboard_input.

is there any way to avoid this?