I was wondering how I can make Flycheck check the modules imported in a python file - to check if function used from a module is correct or not. Is there another mode which is able to do that for me?

For example:

import utils
str = utils.chk("is this right?")

How can I make flycheck(or any other checker) check if the imported file utils contains a function called chk?

I'm currently using python-mode on Emacs 24.4 with pylint and flake8 as checkers for Flycheck on Windows 8.1 64 bit. I also have semantic installed.

Can that help me in anyway?

  • I think something called Pyflake... but I may be wrong.
    – wvxvw
    Commented Jul 9, 2015 at 20:10
  • you can emacs-jedi. jedi doesn't highlight errors, but when you keep your cursor on the line import utils and do Alt - . (goto-definition), it takes you to the module file itself.
    – Saravana
    Commented Jul 13, 2015 at 4:05
  • I know about Jedi. Isn't that for auto completion? Though I just want a checker that checks if the functions I use from any modules are defined and take the correct amount arguments and not go to it's definition or auto complete them for me(Yes, I'm not a big fan of auto complete).
    – Milap
    Commented Jul 13, 2015 at 4:20

2 Answers 2


You can use pylint with flymake. http://docs.pylint.org/ide-integration

UPDATE: I use emacs 24.5 with this configuration:

 (autoload 'flymake-mode "flymake" nil t)
               (eval-after-load "flymake"
                    (require 'flymake-cursor)
                    (defun flymake-pylint-init ()
                      (let* ((temp-file (flymake-init-create-temp-buffer-copy
                             (local-file (file-relative-name temp-file (file-name-directory buffer-file-name))))
                        (list "epylint" (list local-file))))
                    (add-to-list 'flymake-allowed-file-name-masks '("\\.py\\'" flymake-pylint-init))))

Here a screenshot of the control: enter image description here

  • Flymake was the old checker for emacs. Flycheck (for emacs 24) is supposed to be a great improvement on that. I believe pylint (and flake8) works with Flycheck out of the box. And so it seems that pylint doesn't flag errors on module imports.
    – Milap
    Commented Aug 7, 2015 at 11:54
  • @Milap Sheth. Maybe you can use Flycheck instead of Flymake (I don't know why it is better but will try it). But I had a screenshot to show you an example of error on module imports.
    – djangoliv
    Commented Aug 7, 2015 at 12:24
  • Thanks for the screenshot. I'm already using Flycheck as I mentioned in the question. I thought that the particular error E1101 might be disabled in some .pylintrc file although it isn't. So, I don't exactly know why this error is not being shown. The reason I insist on using Flycheck is that it works with many languages and no additional code is required like with Flymake. So, I want to fix the error with flycheck instead of using flymake.
    – Milap
    Commented Aug 8, 2015 at 0:40
  • What should I do to use this function? should I add a keybinding for it? @djangoliv
    – alper
    Commented Apr 27, 2020 at 13:08
  • @alper. M-x flymake on python buffer.
    – djangoliv
    Commented Apr 28, 2020 at 14:52

The reason for this occurrence was quite simple. I assumed that both flake8 and pylint were running together but in reality only flake8 was running as the flycheck's syntax checker. I changed it to python-pylint and now it works as expected.

To do this, just type M-x flycheck-select-checker and enter python-pylint (make sure you install pylint for flycheck from melpa first)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.