I tried to import a file var.py to openfile.py. var is passed as an argument to openfile. I am unable to figure out how to import it by reading the name from command line.
var = sys.argv[1]
importlib.import_module(var, package=None)
I tried the above code but it gave the below error
Traceback (most recent call last):
File "true.py", line 7, in <module>
importlib.import_module(var, package=None)
NameError: name 'importlib' is not defined
importimportlibitself?