Python Practice › sys Module Programs › Program 11
Which modules are loaded?
Write a Python program that checks whether a module has been imported yet.
Output
False True
Approach
sys.modulesholds every loaded module.
Solution
import sys print("json" in sys.modules)import jsonprint("json" in sys.modules)Output
False True
Learn the concept
New to this topic? Read the lesson, then come back.