Is there a way to close PowerFactory from unattended mode?

Category:
Scripting
Answer

There is a way of closing the PowerFactory application in Python without closing the Python

In this case you can open PowerFactory by using „app = powerfactory.GetApplicationExt()“ and later on just with “del app” PowerFactory will be removed

 

import sys

sys.path.append(r"E:\DIGSILENT\PowerFactory-2019_SP2_x64\Python\3.7")

import powerfactory

# start PowerFactory

app = powerfactory.GetApplicationExt()

app.Show()

# ... do something with PowerFactory

# shutdown PowerFactory

del app

 # ... do something without PowerFactory

print('PowerFactory is closed but Python script is still alive')

 

When PowerFactory was started by a Python script from external and the application object is deleted then PowerFactory is terminated but the current process keeps running. In this situation, it is not possible to start PowerFactory again in the same process.

Back