Python path variable for user-defined modules

I am trying to add user-defined python module path to .bashrc file using export KLAYOUT_PYTHONPATH=$KLAYOUT_PYTHONPATH:/u/.klayout/pymacros. However, I am unsuccessful in doing so. Any suggestion?

Klayout version:0.27.2
OS: Ubuntu 20.04.3 LTS


  • You need to specify the full path in KLAYOUT_PYTHONPATH and as it's not set in advance, you cannot add to it:

    export KLAYOUT_PYTHONPATH=$(python3 -c "import sys; print(':'.join(sys.path))"):/your/path

    Of course it's easier to add your path in your script itself:

    import sys


    Also Ubuntu

  • Thank you very much, Matthias!

Sign In or Register to comment.