By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,199 Members | 1,120 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,199 IT Pros & Developers. It's quick & easy.

Using class without importing module

P: n/a
Hi all.

I'm sending a class over a socket connection, and I want to use this class
at the new location. The problem is that I get a "module blah does not
exist" error.

Is it possible for me to use this class without importing the module? How?

Any other suggestions?
Cheers,
Thomas
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Thomas Aanensen wrote:
Hi all.

I'm sending a class over a socket connection, and I want to use this class
at the new location. The problem is that I get a "module blah does not
exist" error.

Is it possible for me to use this class without importing the module? How?

Any other suggestions?


It sounds like you are using:

import Pickle
socketinstance.send(Pickle.dumps(classinstance))

The above doesn't work. Pickle only encodes the data associated with
that class, not the bytecode required for the functionality. It refers
to the module.class reference to deal with reconstructing it later from
the pickle.

In general, you do need to import the module in order to use the class.

- Josiah

Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.