Without your test script or more info, it's hard to tell whether you have incorrectly configured the path to the Dymola python module or whether it's another issue (like casing, the module is apparently dymola
, not Dymola
)
(It also doesn't help that I don't use windows neither do I use Dymola... :))
Seems like it should probably start with from dymola.dymola_interface import DymolaInterface
, and if you aren't setting your PYTHONPATH
variable before launching python (set PYTHONPATH=%PYTHONPATH%;C:\Path\to\Dymola\Modelica\Library\python_interface\dymola.egg
), you should have something like his before trying to use dymola:
import sys
from pathlib import Path
DYMOLA_INSTALL_PATH = Path(r'C:\path\to\Dymola\')
DYMOLA_EGG = DYMOLA_INSTALL_PATH / 'Modelica/Library/python_interface/dymola.egg'
sys.path.insert(0, str(DYMOLA_EGG))
from dymola.dymola_interface import DymolaInterface
dymola = DymolaInterface()
res = dymola.simulate("myModel")
Personal 2 cents: I generally recommend using the sys.path.insert
inside the script approach instead of setting the PYTHONPATH
env variable, you'll avoid some issues.