Reputation: 759
Is there an easy way in PyCharm (Community Edition) to update references to a function that has moved from current file.py to some module?
Originally
main.py:
def foo():
def bar():
return foo()
def baz():
return foo()
Now
main.py
import MyFunc
def bar():
return MyFunc.foo()
def baz():
return MyFunc.foo()
MyFunc.py
def foo():
This all works well, but I'm in the process of refactoring and going through the entire code manually fixing references to "foo()" is a bit of a pain. Code->Inspect Code helps greatly but is there a way to "Refactor move function to module"?
Upvotes: 1
Views: 791
Reputation: 97338
Refactor | Move... does this for you. Note that it moves the function and updates the references; you can't invoke it after the function has been moved.
Upvotes: 1