0

I created a new module with importlib using the following lines of code:

#loader is None, new spec created
spec = importlib.util.spec_from_loader(name, loader=None,
origin=self.url)

#creates a new module based on spec and spec.loader.create_module                                      
new_module = importlib.util.module_from_spec(spec)

Now the book I'm reading does this:

exec(self.current_module_code, new_module.__dict__)

I think that the exec() function is meant to execute modules but what does it do in this case? I cannot find anything online that answers this question.

thom0075
  • 1
  • 4

0 Answers0