send command on arduino via pyserial or command prompt

i know that you can send command from python to arduino using

ser.write(x)

in the code, but how can i send a command by typing it in pyserial or command promt?

After I run python code using command prompt, i could no longer type anything.

Did you have a question about programming the Arduino? This is not the (part of the) forum for discussing PC software.

dazmehard:
how can i send a command by typing it in pyserial or command promt?
...SNIP...
After I run python code using command prompt, i could no longer type anything.

I don't understand what you mean by the second line. While the Python code is running the command prompt won't be accessible - assumung you run the Python code from the command line.

Also, if the Python code is talking (or trying to talk) to your Arduino it will be using the serial connection so no other program can talk to the Arduino.

You can always write a Python program that takes in text from the keyboard and sends stuff to an Arduino.

...R

You can always write a Python program that takes in text from the keyboard and sends stuff to an Arduino.

yes, that is what m trying to figure out. do you have any suggestion on how to do it?, like do i have to create GUI? im new to python, so im trying to figure how will it take external command.

dazmehard:
yes, that is what m trying to figure out. do you have any suggestion on how to do it?, like do i have to create GUI? im new to python, so im trying to figure how will it take external command.

This is really not the place to be asking for a Python keyboard input tutorial - this is the first one DuckDuckGo found for me

If you want to use a GUI you can. This GUI demo may give you some ideas. Or, if you don't want to use a GUI this Python Arduino demo may be useful.

...R