ahserver_g/doodahs/loadplugins.py
2022-05-31 10:56:19 +08:00

18 lines
388 B
Python

import os
import sys
from appPublic.folderUtils import listFile
from appPublic.ExecFile import ExecFile
def load_plugins(p_dir):
ef = ExecFile()
pdir = os.path.join(p_dir, 'plugins')
if not os.path.isdir(pdir):
print('load_plugins:%s not exists' % pdir)
return
sys.path.append(pdir)
for py in listFile(pdir, suffixs=['.py'], rescursive=True):
ef.set('sys',sys)
ef.run(py)