Changes made to embedded script in a Python script tool do not persist

Last Published: April 25, 2020


After embedding a Python script, edits made by right-clicking the script tool and clicking 'Edit' do not persist after closing the ArcGIS session. This means that changes made in this environment are lost when closing the application.


When a script tool is accessed, it creates a temporary Python script file in a Windows Temp directory. Upon closing the application, this directory is cleared. When edits are made to the script, they are applied to the temporary file. These changes are not posted back to the original code. Therefore, any changes that are made to the script are temporary to the session and do not apply to the actual source script from which the temporary file was created. This has been documented as NIM091684.


To make permanent changes to the source code, export the script by right-clicking it and clicking Export Script, make changes to the exported script, and import the script back if desired.

    Article ID:000011780

    • ArcMap

    Get help from ArcGIS experts

    Contact technical support

    Download the Esri Support App

    Go to download options

    Related Information

    Discover more on this topic