.. _wrong-import-order: wrong-import-order / C0411 ========================== **Message emitted:** ``%s should be placed before %s`` **Description:** *Used when PEP8 import order is not respected (standard imports first, then third-party libraries, then local imports).* **Problematic code:** .. literalinclude:: /data/messages/w/wrong-import-order/bad.py :language: python **Correct code:** .. literalinclude:: /data/messages/w/wrong-import-order/good.py :language: python **Additional details:** Pylint uses ``isort`` to classify imports into standard library, third-party, first-party, and local import groups. ``isort`` detects first-party imports by looking for packages relative to the current working directory. As a result, running pylint from different directories can change how the same import is classified. For example, with the following project layout:: project/ src/ my_package/ __init__.py module.py An import of ``my_package`` in ``module.py`` may be treated as first-party when pylint is run from ``project/src``, but as third-party when pylint is run from ``project``. If this warning fires, or fails to fire, inconsistently between runs, set ``known-first-party`` in your pylint configuration to make the classification deterministic:: [tool.pylint.imports] known-first-party = ["my_package"] Created by the `imports `__ checker.