Scripts not updating on import?
I discovered this in a more complex set of code, but I've boiled the issue down to two very simple scripts:
from helper import helpfunc print helpfunc(6)
def helpfunc(val): return 2*val
Am I missing something?
reload( helpfunc )at the end of
mainprog.py, it should do the math.
Got a TypeError when I tried that. reload wanted a module.
import helper; reload(helper)before the from-import.
module objects— successfully imported before — only …
Yup. That worked. Thanks!
I'm not a python expert, but is this something unique to pythonista? I've not encountered this before in other IDEs.
It's kind of unique to Pythonista – IDEs on other platforms usually run scripts in a separate process, this is technically impossible to do on iOS (at least in an App Store app), so Pythonista runs a single interpreter and imports are cached (which is just how Python works, it's the same on any platform when you use the command-line Python).