this is a weird bug that started happening with more recent releases of burpsuite. It will usually resolve its self if you restart burp. There are a few workarounds for now..
Write the scripts in a different text editor and click import on every change.
The script file is stored in ~/.NoPEProxy/mangler.py. Edit this file directly and the changes should be automatically updated in nope.
Cannot write scripts in Automation