Answer the question
In order to leave comments, you need to log in
How to reimport a module before running :PymodeRun in python-mode for vim?
Let's say there are two simple files open in vim:
file1.py value = 'test'
and file2.py
from file1 import value
print(value)
value = 'new test'
Answer the question
In order to leave comments, you need to log in
I got it myself
1. The solution "on the forehead"
in the file file2.py do not use from and temporarily add reload:
import file1 as f
import imp
imp.reload(f)
print(f.value)
+ m_keys = sys.modules.keys()
37 code = compile('\n'.join(lines) + '\n', env.curbuf.name, 'exec')
38 sys.path.insert(0, env.curdir)
39 exec(code, context) # noqa
40 sys.path.pop(0)
+ for k in set(sys.modules) - set(m_keys):
+ del sys.modules[k]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question