Module is imported more than once¶
ID: py/repeated-importKind: problemSecurity severity: Severity: recommendationPrecision: very-highTags: - quality - maintainability - useless-codeQuery suites: - python-security-and-quality.qls
Click to see the query in the CodeQL repository
Importing the same module more than once has no effect as each module is only loaded once. It also confuses readers of the code.
Recommendation¶
Remove the second import.
Example¶
importmodule1importmodule2importmodule1# Duplicate import
References¶
Python:import statement.