use crate::cache::Cache;
use crate::helper::load_script;
use pyo3::prelude::*;
pub fn exec(module: &str) -> Result<Vec<String>, crate::Error> {
pyo3::prepare_freethreaded_python();
let script = load_script(&module)?;
let cache = Cache::new()?;
let gil = Python::acquire_gil();
let py = gil.python();
let pym = PyModule::from_code(py, &script, "plan.py", "plan")?;
let sps = serde_json::to_string(&cache.get_problems()?)?;
let stags = serde_json::to_string(&cache.get_tags()?)?;
let res: Vec<String> = pym.getattr("plan")?.call1((sps, stags))?.extract()?;
Ok(res)
}