Library (Sdk sdk) { final LibraryTable.ModifiableModel libraryTableModel = ModifiableModelsProvider.getInstance().getLibraryTableModifiableModel(); final Library library = libraryTableModel.createLibrary(PythonFacetUtil.getFacetLibraryName(sdk.getName())); final Library.ModifiableModel model = library.getModifiableModel(); for (String url : sdk.getRootProvider().getUrls(OrderRootType.CLASSES)) { model.addRoot(url, OrderRootType.CLASSES); model.addRoot(url, OrderRootType.SOURCES); } model.commit(); libraryTableModel.commit(); return library; }