Skip to main content
1 of 7
Nihathrael
  • 641
  • 4
  • 12

Using exec() is generally regarded as bad practice (http://stackoverflow.com/questions/1933451/why-should-exec-and-eval-be-avoided). Since you are trying to import a module, you can do the same by using the importlib package.

Python 2: https://docs.python.org/2/library/importlib.html

Python 3: https://docs.python.org/3/library/importlib.html#module-importlib

Using it should clean up the rest of the code as well.

Nihathrael
  • 641
  • 4
  • 12