I have Python scripts that use the if __name__ == \'__main__\' trick to have some code only run when the script is called as a script and not when it is loaded
IPython automatically executes the code you write with the %edit command. You can use %edit -x to specify that you do NOT want to run the code you were just editing.