Controlling a stepper motor with python

I am attempting to control a stepper motor with python. The commands I am attempting to send are:
MN
LD3
MR1000
5
V10
D30000
G
Here is the code I have:

import serial
ser = serial.Serial('COM6',9600)
cmd = 'MN\n' + 'LD3\n' + 'MR1000\n' + 'A5\n' + 'V10\n' + 'D30000\n' + 'G\r\n'
ser.write(cmd.encode())

Can someone tell me what I am doing wrong?

No, but you could help yourself by printing cmd after putting all the text into it and see what you actually have there.

The commands are definitely correct, I am not sure if I am encoding them correctly though.

And I have no clue about what you mean by "encoding them properly"!

I know nothing about stepper motors, I do not know if the stepper motor is getting the commands or not.

I guess we will never know what you are doing, since you have only, ever, shown a snippet of code relating to serial output.

Welcome to the forum.

Did you bother to read the how to get he most from the forum posts?

Those posts will tell you what sort of information that we need in order to help you.

Information that is helpful:
Please post your code. Clean it up by running the IDE autoformat tool before posting in code tags as suggested by the how to get the most threads,

A schematic or wiring diagram is often helpful and are always less ambiguous than a written description. Show all components and power supplies.

Clear photos of the wiring are always welcome.

After opening the serial port in python, the Arduino resets and the bootloader is invoked. You will have to wait till the bootloader is finished doing what it is doing. Adding a delay of 10 seconds after ser = serial.Serial('COM6',9600) will do. The 10 seconds is chosen because you did not specify the board that you're using.

The better way is to send a message (in setup()) from the Arduino to the PC and your python script should wait till it has received this message after it has opened the serial port.

for an example of this see the small tutorial on interfacing with Python I've written Two ways communication between Python3 and Arduino