Search code examples
pythonpylint

How to check if user defined functions is missing on the file from which it was imported using pylance?


I'm refactoring a large codebase. And I have migrated many function here and there.

I want to filter pylint output to show me error like my_function doesn't exist in helper.py function anymore.

# ------ Before refactor ------

# File helper.py
def my_function():
    pass

# File controller.py
from my_module.helper import my_function

After refactor, let's say my_function() has been moved to a new file utils.py instead. How can I observe such errors using pylint ?

I'm using pylint $(git ls-files '*.py') command to run linting on project.


Solution

  • It is not possible. Pylance is only a static code analysis tool and this error only occurs during runtime. So, not possible.