Why does ComPython ignore changes in module?

Category:
Scripting
Summary

When I make some changes inside of the module I import in my main py file, I am not able to see this changes. Only after closing PowerFactory and opening it again new changed module will be taken into account.

Answer

This is something typical for Python. What you should do is import imp module and reload the changed one. Imp module is built in module and is part of all python version supported by PowerFactroy. For more information on imp module refer to python literature.

Example:

import powerfactory as pf

app=pf.GetApplication()

import sys

import imp #importing imp module

sys.path.append(r'C:\Users\....\PythonFolder')

import subModule #importing module you are using as subscript

imp.reload(subModule) #reloading of module just to take all possible changes into account

subModule.func(app) #calling a subfunction from the subModule

Back