Fazer wrote:
BW Glitch <bw******@hotpop.com> wrote in message news:<br************@ID-203388.news.uni-berlin.de>...
Fazer wrote:Thanks! The recipe works out fine! The problem is that I saved the
class in a file and I want it to be included in my other script. How
can that be done? My other script is in the same directory as the
class and doing import <name of class> doesn't work.
You should import <filename minus .py*>
Thanks for the responce! I put the class and the final function in a
tags.py file. I make another script and do : "import tags"
It works, but when I try to make a new class instance, it can't seem
to find it.
There are two ways to import modules, "import module" and "from module
import *". The latter is seldom recommended.
By doing a "import module", anything inside the module must be called
like this:
### begin example
import sys
sys.exit(0)
### end example
When you do a import tags, everything inside tags must be called
tags.CLASS .
HTH,
--
Glitch
-----BEGIN TF FAN CODE BLOCK-----
G+++ G1 G2+ BW++++ MW++ BM+ Rid+ Arm-- FR+ FW-
#3 D+ ADA N++ W OQP MUSH- BC- CN++ OM P75
-----END TF FAN CODE BLOCK-----
Blackarachnia: "We're almost through."
Silverbolt: "Then ... stand back!"
Blackarachnia: "Wait. We just have to--"
[BLAM!]
Blackarachnia: "Never mind ... What is it with guys and high
explosives?"
("The Agenda" III)