python help

I'm having trouble writing a script that sends an H or an L to my board. when i write the commands on the interactive window everything works fine but when i start it as a script nothing happens. I'm new to both python and arduino.