Attribute error when loading pickle file in python jupyter notebook I have created a config file with the following code for an object detection task and saved in the local disk.

# Create the config
C = Config()
C.use_horizontal_flips = horizontal_flips
C.use_vertical_flips = vertical_flips
C.rot_90 = rot_90
C.record_path = record_path
C.model_path = output_weight_path
C.num_rois = num_rois
C.base_net_weights = base_weight_path

with open(config_output_filename, 'wb') as config_f:
pickle.dump(C,config_f)


I am trying to load this pickle file in another jupyter notebook.

with open(config_output_filename, "rb") as f:
C = pickle.load(f)    
# turn off any data augmentation at test time
C.use_horizontal_flips = False
C.use_vertical_flips = False
C.rot_90 = False
print(C.num_rois)


But it gives me the following error.

------------------------------------------------------------------------ 

AttributeError             Traceback (most recent call 
last)
 &lt;ipython-input-20-c5528d5ef98b&gt; in &lt;module&gt;
  1 with open(config_output_filename, "rb") as f:
   ----&gt; 2     C = pickle.load(f)

  AttributeError: Can't get attribute 'Config' on &lt;module '__main__'&gt;


But I was able to load the pickle file from the disk without errors in my previous attempts and applied the configurations on the test set.
I guess the Config() is a class that you created. It will be needed again when you load a pickle file storing the config. Therefore, you need to import it in the jupyter notebook you use to load your pickle file. 

Hope this could be helpful.