My code is this:
for module in ["ffmpy","os","sys"]:
try:
__import__(module)
except:
print("Can't import ["+module+"]")
So, I want to import this globally, but it doesn't seem to do this. After this code, I have sys.path.insert(0, r"C:\Users\david\Desktop\scripts")
,and the python console tells me: NameError: name 'sys' is not defined
. I don't know what I'm doing wrong, but you hopefully do.
edit: This Question is not a duplicate, because i don't 'just' want to import from string, but do that from a for loop. I basically want to import from a string, in a loop, globally.