do the import inside to_pickle