Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9132077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:14:59+00:00 2026-06-17T08:14:59+00:00

The python docs say: pickle can save and restore class instances transparently, however the

  • 0

The python docs say:
pickle can save and restore class instances transparently, however the class definition must be importable and live in the same module as when the object was stored.
Could I put a pickler/unpickler in the module where the class was stored?
Or do I have to put the class in the module? And how?
I’m trying to pickle/unpickle a object from a class in a external module.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:15:00+00:00Added an answer on June 17, 2026 at 8:15 am

    You can pickle any python class instance, as long as the pickle module can import it again when you load the pickle.

    It doesn’t matter where in your python code you use load() or dump(), it only matters if the data that you are going to pickle can be retrieved again later on, by importing them from the same location.

    So, if you have a module foo.bar with a class Spam in it, then as long as you can do from foo.bar import Spam you can pickle instances of that class, because pickle can later on load that class again from the same module.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Python docs say that * and / have the same precedence. I know
The docs for the python dev server say this about running tasks: When your
I'm using Python 2.6.2. The docs for the filecmp module say: The filecmp module
The Python 2 docs for filecmp() say: Unless shallow is given and is false,
The Python docs say: re.MULTILINE: When specified, the pattern character '^' matches at the
I'm trying to encode instances of a custom python class ISOWeek using python 2.7's
Using this example from http://docs.python.org/tutorial/classes.html#class-objects : class MyClass: A simple example class i =
The python docs say: Return the length (the number of items) of an object.
The entry for sys.path[0] is '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode' . The Python docs say this should be
In the Python docs I found that logging messages are possible in python scripts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.