Add class to run a single module

This commit is contained in:
Marcel Schwarz 2019-12-14 05:18:04 +01:00
parent 581bcb641b
commit 1366b53c20

18
SingleModuleRunner.py Normal file
View File

@ -0,0 +1,18 @@
import os
import importlib
def run_module(name):
for folder in os.listdir("./modules"):
if folder == name:
print("Module found: " + folder)
curr_module = importlib.import_module('.' + folder, package="modules")
print("Try to load module: " + folder)
instance = curr_module.get_module()
print("Module loaded successfully: " + folder)
instance.get_command()
return
raise FileNotFoundError("The specified module was not found.")
run_module(input("Please specify module: "))