To save a Python script (*.py) file, invoke and display the file in the Scripts pane. Press the Save button.
For more information on automation via Python scripting, see Application Automation with Python.