Path (@NotNull Project project, @NotNull String moduleName, @NotNull String moduleTypeId) { Path imlFile = myProjectDir.resolve(moduleName + ".iml"); ApplicationManager.getApplication().runWriteAction(() -> { ModuleManager.getInstance(project).newModule(imlFile.toAbsolutePath().toString(), moduleTypeId); }); return imlFile; }