monolith/utils/loaders/single_loader.py

18 lines
565 B
Python
Raw Normal View History

from os import listdir
import main
from utils.logging.log import *
import commands
def loadSingle(command, func):
if command+".py" in listdir("commands"):
try:
if command in main.CommandMap.keys():
return "Cannot reload modules"
else:
className = command.capitalize()
__import__("commands.%s" % command)
eval("commands.%s.%s(func)" % (command, className))
return True
except Exception as err:
return err