Can't you do some kind of static analysis instead?
Depends if your code has horrors like this lurking in it:
m = importlib.import_module(requests.get("http://localhost:8000/package_name").content.strip().decode("ASCII"))
Yes. It is much more clear to be explicit though.
Depends if your code has horrors like this lurking in it:
m = importlib.import_module(requests.get("http://localhost:8000/package_name").content.strip().decode("ASCII"))