Executing script in Python window of ArcMap?
You could use execfile
.
For instance,
>>> execfile(r'c:\my\script.py')
I am not sure of your level of experience, but before you get too far in you will want to learn some best practices in Python. It would be more idiomatic, or "Pythonic", to modularize your code into functions/classes, import
your module, and call one or more functions/classes.
If you want to make changes and interactively test the already-imported module, you can use the reload
built-in function.
Use the if __name__ == '__main__'
trick to protect your script's main procedure (everything other than imports, function/class declarations, and maybe some module-level variable declarations) from automatically running upon importing the module, and only execute that logic when running the script directly, e.g. from a command prompt or through ArcToolbox.
Then you can test specific parts of your module by just calling the relevant classes/functions.