Python Console with Python 3.4.2
I defined a function in a module that works correctly in the Python Console in PyCharm Community Edition 4.5.4:
ReloadTest.py:
def reloadtest(x): print("Version A: {}".format(x))
Python Console:
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:15:05) [MSC v.1600 32 bit (Intel)] on win32 >>> from ReloadTest import reloadtest >>> reloadtest(1) Version A: 1
After I changed the function to "Version B", PyCharm cannot find the changes, and importlib.reload(ReloadTest) gives me an error.
I have to restart the Python Console or restart PyCharm every time I change the module. What have I done wrong? What is the best way to handle this?
ReloadTest.py:
def reloadtest(x): print("Version B: {}".format(x))
Python Console:
>>> reloadtest(1) Version A: 1 >>> from ReloadTest import reloadtest >>> reloadtest(1) Version A: 1 >>> import importlib >>> importlib.reload(ReloadTest) Traceback (most recent call last): File "<input>", line 1, in <module> NameError: name 'ReloadTest' is not defined >>> from ReloadTest import reloadtest >>> reloadtest(1) Version A: 1 >>> import ReloadTest >>> reloadtest(1) Version A: 1
source share