import subprocess import sys def run_matsim(config_file_path=None): java_path = "java" jar_path = "matsim.jar" command = [java_path, "-jar", jar_path] if config_file_path: command.append(config_file_path) subprocess.run(command) if len(sys.argv) > 1: config_file = sys.argv[1] else: config_file = None run_matsim(config_file)