Commit 0f94a2c1 authored by chsieh16's avatar chsieh16
Browse files

Add absolute path to sys.path to fake relative import dynamic models

parent 509cbce8
......@@ -36,13 +36,20 @@ def importSimFunction(path):
simulation function
"""
path = path.replace('/', '.')
try:
module = importlib.import_module(path)
except ImportError:
# FIXME TC_Simulate should just be a simple call back function
import os
import sys
sys.path.append(os.path.abspath(path))
mod_name = path.replace('/', '.')
module = importlib.import_module(mod_name)
sys.path.pop()
return module.TC_Simulate
except ImportError as e:
print("Import simulation function failed!")
return module.TC_Simulate
print(e)
exit() # TODO Proper return
def randomPoint(lower, upper):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment