Updates in scripts are not loading

Each time when I am making any changes in scripts I am working on (Python) I need to restart KLayout so changes appear during runtime.
The only changes that are loaded in right way are for the entry point script, but any script which is used through import is frozen and I cant see changes until restarting client.

Is there proper way to save these changes during work so they appear within current session?

Comments

  • Is there no way to force a "reload"? In other tools I've seen
    "trigger all callbacks" or "refresh" but not always easy to
    find.

    Or maybe you have to close the script editing session
    and reopen it from within the existing klayout session?

  • @dick_freebird , I have tried many things: closing and opening Macro Development window, editing script using external editor and reloading it in Macro Development window (in this case it does see that script was changed, but I dont see any changes during runtime though)...
    Still, the only way is rebooting klayout...

  • @alexlpn Sorry, I don't fully understand. You say you're changing a script in a text editor separately and then expect KLayout to load it somehow?

    This will not work for a variety of reasons. The main reason is that KLayout embeds a Python and Ruby interpreter and both do not re-execute files automatically.

    Re-executing a file from the command line ("Macro editor console") is possible:

    In Python 3:

    exec(open("/path/to/file.py").read())
    

    In Ruby:

    load("/path/to/file.rb")
    

    You cannot load ".lym" files this way. But .lym files are intended for use with the internal macro IDE anyway.

    I don't know what kind of scripts you are developing. Depending on the things you are doing there may be smarter ways. For example, I got reports by people who use PyCharm and configure KLayout as Python interpreter. So you don't need to restart KLayout - PyCharm does it for you.

    Matthias

Sign In or Register to comment.