Imports with Pydev/Eclipse
Question
I'm working with the interactive console in eclipse, and reload does not show updated functions in my code. My code was :
def func1():
return 1
def func2():
return 2
but when I changed it to
def afunc1():
return 1
def func2():
return 2
def func1():
return 3
and ran imp.reload(TestMod), I got a 'module' object has no attribute 'afunc1()'
.
Also, sometimes the functions are loaded and sometimes they are not.
Solution
Turns out, eclipse was not saving the file (or not saving it to the correct location) when I hit ctl-s. To get it to work, I had to right click the file name in the Package Explorer and select open with PyDev and save it under that
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow