First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
1 | initial version |
When running in PSSe (GUI), there is no need to import psspy. It is loaded automatically when PSSe start up. PSSe changes the working directory to the folder where the python script is located. This action could mess the relative path to access other python scripts from the main script. If absolute paths are used (full path starting from c:), importing or loading files should work ok.
Print the "sys.path" before the error occurs in both cases (in GUI or outside of it), looking for differences or missing paths.
The posted code looks ok to me (btw, I don't see the need to update "os.environ['PATH']"). You can post enough of your code (main + boilerplate code) to check the problem happening.