diff --git a/Applications/ApplicationsLib/CMakeLists.txt b/Applications/ApplicationsLib/CMakeLists.txt
index 64bb9c8717445ea5e5994728959e5d14fd50af23..9d734bcb839430e8e13bc73f572b84b1cf756a79 100644
--- a/Applications/ApplicationsLib/CMakeLists.txt
+++ b/Applications/ApplicationsLib/CMakeLists.txt
@@ -10,10 +10,6 @@ target_link_libraries(ApplicationsLib
     PRIVATE MathLib MeshLib MeshGeoToolsLib NumLib
 )
 
-if(OGS_USE_PYTHON)
-    target_include_directories(ApplicationsLib PRIVATE ${PYTHON_INCLUDE_DIRS})
-endif()
-
 # Set cpp definitions if the cmake option is enabled for the given process.
 foreach(process ${ProcessesList})
     if(OGS_BUILD_PROCESS_${process})
@@ -26,3 +22,7 @@ endforeach()
 if(OGS_USE_PCH)
     cotire(ApplicationsLib)
 endif()
+
+if(OGS_USE_PYTHON)
+    target_link_libraries(ApplicationsLib PRIVATE pybind11::pybind11)
+endif()
diff --git a/Applications/ApplicationsLib/ProjectData.cpp b/Applications/ApplicationsLib/ProjectData.cpp
index de782c13f956efde4b975147ad9a0efd64d8fa6d..d3d07d07bd6c47cdf07a5820f03a169a120152a5 100644
--- a/Applications/ApplicationsLib/ProjectData.cpp
+++ b/Applications/ApplicationsLib/ProjectData.cpp
@@ -166,11 +166,11 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config,
 {
     _mesh_vec = readMeshes(project_config, project_directory);
 
-#ifdef OGS_USE_PYTHON
     if (auto const python_script =
-            project_config.getConfigParameterOptional<std::string>(
-                "python_script"))
+            //! \ogs_file_param{prj__python_script}
+        project_config.getConfigParameterOptional<std::string>("python_script"))
     {
+#ifdef OGS_USE_PYTHON
         namespace py = pybind11;
         auto const script_path =
             BaseLib::copyPathToFileName(*python_script, project_directory);
@@ -178,8 +178,10 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config,
         // Evaluate in scope of main module
         py::object scope = py::module::import("__main__").attr("__dict__");
         py::eval_file(script_path, scope);
-    }
+#else
+        OGS_FATAL("OpenGeoSys has not been built with Python support.");
 #endif  // OGS_USE_PYTHON
+    }
 
     //! \ogs_file_param{prj__curves}
     parseCurves(project_config.getConfigSubtreeOptional("curves"));