Im having problems trying to work with multiple python files…
I have theses 2 file that are calling each other
test1.py
import test2
from test2 import *
print "test1"
hello_test2()
print
test2.py
def hello_test2():
print "test2"
When I execute test1.py, the output on the console is as expected:
test1
test2
Now, if I modify test2.py and modify it to be ie the following:
def hello_test2():
print "test2"
print "test3"
Then I save test2.py, go back to test1.py and execute the script again, Im still having the same output on the console:
test1
test2
Where is the print of test3? Dunno but its not there, the only way that I found to make blender “realize” that the function hello_test2 have been modified and now include print “test3”, is to close blender and reload the file test1.py and test2.py…
Am I missing something?
How can I force blender to consider the changes that Im doing in test2.py without having to close it and reload my scripts?
the problem is in the python, it load the modules once in the first call, and rest in memory.
I search in the python api for a solution, but all my tries don’t work.
Finally my solution is rename the file that I call. and the import file in my script and it work well.
Example:
file :module1.py in the script: from module1 import *
made mofifications in the module1.py
rename module1.py to module2.py and modify main script to: from module2 import *
Yeah, that is the limitation of python (maybe it’s blender). If you import a library, that is the way I think if it, you can no longer make code changes to that library unless you restart blender. When I am developing script it is an endless series of open/edit/run/save/close repeat etc…
CTRL-S
CTRL-Q