Add file's dir to sys.path
@@ -14,17 +14,21 @@ Currently, two loading modes are supported, both are equivalent to Python CLI:
Multiple files/modules can be specified. They will be loaded in the order.
"""
+import sys
import importlib
import importlib.util
import os.path
+
def preload(paths, modules):
"""
Ensure the handlers are registered by loading/importing the files/modules.
"""
for path in paths:
+ print(path )
+ sys.path.append(os.path.abspath(os.path.join(path, os.pardir)))
name, _ = os.path.splitext(os.path.basename(path))
spec = importlib.util.spec_from_file_location(name, path)
module = importlib.util.module_from_spec(spec)
