@@ -202,7 +202,7 @@ def __init__(
202202
203203 self ._raiseerrors = raiseerrors
204204
205- if fileName is not None and not self .fileName .is_file (): # if file does not exist
205+ if self . fileName is not None and not self .fileName .is_file (): # if file does not exist
206206 raise IOError (f"File Error: { self .fileName } does not exist!!!" )
207207
208208 # set default command Line Options for linearization as
@@ -213,13 +213,13 @@ def __init__(
213213
214214 self .setTempDirectory (customBuildDirectory )
215215
216- if fileName is not None :
217- self .loadLibrary ()
218- self .loadFile ()
216+ if self . fileName is not None :
217+ self .loadLibrary (lmodel = self . lmodel )
218+ self .loadFile (fileName = self . fileName )
219219
220220 # allow directly loading models from MSL without fileName
221- if fileName is None and modelName is not None :
222- self .loadLibrary ()
221+ elif fileName is None and modelName is not None :
222+ self .loadLibrary (lmodel = self . lmodel )
223223
224224 self .buildModel (variableFilter )
225225
@@ -231,17 +231,17 @@ def setCommandLineOptions(self, commandLineOptions: str):
231231 if not self .sendExpression (exp ):
232232 self ._check_error ()
233233
234- def loadFile (self ):
234+ def loadFile (self , fileName : pathlib . Path ):
235235 # load file
236- loadMsg = self .sendExpression (f'loadFile("{ self . fileName .as_posix ()} ")' )
236+ loadMsg = self .sendExpression (f'loadFile("{ fileName .as_posix ()} ")' )
237237 # Show notification or warnings to the user when verbose=True OR if some error occurred i.e., not result
238238 if self ._verbose or not loadMsg :
239239 self ._check_error ()
240240
241241 # for loading file/package, loading model and building model
242- def loadLibrary (self ):
242+ def loadLibrary (self , lmodel : list ):
243243 # load Modelica standard libraries or Modelica files if needed
244- for element in self . lmodel :
244+ for element in lmodel :
245245 if element is not None :
246246 if isinstance (element , str ):
247247 if element .endswith (".mo" ):
0 commit comments