321 def __init__(self, path=None, modules=None):
322 """Initialises the module with a path to be wrapped.
323
324 May also give a list of modules that should be appended to the path.
325 If the path is omitted a new basf2.Path is constructed.
326
327 Args:
328 path (basf2.Path): The execution path to be wrapped.
329 If no path is given create a new one.
330
331 modules (iterable of basf2.Module): Module to be added to the path.
332 """
333
334 super().__init__()
335
336 if path is None:
337 path = basf2.create_path()
338
339
340 self._path = path
341
342 if modules:
343 for module in modules:
344 path.add_module(module)
345
346 self.if_true(path, basf2.AfterConditionPath.CONTINUE)
347
348
349 if modules is None:
350 itemCount = 0
351 else:
352 itemCount = len(modules)
353 self.set_name(f"{self.__class__.__name__} ({itemCount} modules):")
354