import PyQt5
from PyQt5.QtWidgets import *
print(dir(PyQt5.QtWidgets))
That above code runs perfectly. But when I use a variable it gives an error.
qw="QtWidgets"
print(dir(PyQt5.qw))
AttributeError: module 'PyQt5' has no attribute 'qw'. Is there anyway I can do that? The reason I use variable is because I want a user input to choose what modules to print(dir()).