I want to use importlib to reload a module whose name is dynamically generated.
Example:
import sys
def some_func():
return "sys"
want_reload = some_func()
Now how do I reload the module sys using the variable want_reload? I can't supply it directly to importlib.reload() because it says it expects a module, not str.
It would be better if an invalid string, or a module that's not loaded, is supplied, e.g. "........", that it raises an exception.