[Tutor] How Do I Make Imports Work
Alan Gauld
alan.gauld at btinternet.com
Thu Dec 27 15:46:07 CET 2007
<james.homme at highmark.com> wrote
> I am just starting to learn about making classes, so I wanted to put
> some
> code into a module and use it.
Good idea.
> move it into its own file and try to use an import statement to
> bring it
> in, I get errors that say that methods don't exist.
Are you remembering to prefix the class/functions with the
module name? Have you instantiated the class correctly?
Can we see the import statement and the error messages please?
BTW Does it work at the >>> prompt?
> tutorial that instructs me to edit my registry.
You should not need to edit the registry for this.
But you may need to save the file somewhere that Python can find it!
And you may need to set your PYTHONPATH environment variable.
> talking about the version of Python from python.org. I have
> ActiveState
> Python.
Shouldn't make any difference for this.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
More information about the Tutor
mailing list