how can I reset the unreal-python interpreter?

if there are 2 scripts in a folder like :
A.py
B.py

I’m using my python script to import other script like:

in A :

import B
B.function()

after then, I run A.py in the blueprint.

if I change A, result is also changed immediately.
but if I change B, result isn’t changed.
also, I can’t reset it by using “reload(B)”.

so I think if I reset the interpreter, everything is fine.
how can I reset the interpreter? or is there another solution in this situation?

thanks for your answer!

1 Like

I encountered this problem recently, I don’t know if you found a solution but I found a workaround if anybody else is wondering.

In the editor, at the Python command/execution box during your session, do this:

import sys

If you make changes to a local module that your main module imports, to force it to be reloaded issue the following command (in my case I was including “ui_main.py” in my main code)

del sys.modules["ui_main"]

This will remove it from the cache of loaded modules and any changes you make will be reflected when you next invoke your main script.

1 Like