Module (@NotNull Project project, @NotNull Path moduleFile) { try { // temporary workaround for IDEA-147530: otherwise if someone saved module with this name before the created module will get its settings Files.deleteIfExists(moduleFile); } catch (IOException e) { throw new RuntimeException(e); } return WriteAction.compute(() -> { return ModuleManager.getInstance(project).newModule(moduleFile, getModuleTypeId()); }); }