Access to variable from external imported module

John Machin sjmachin at lexicon.net
Fri Nov 24 03:30:05 EST 2006


jim-on-linux wrote:
> GinTon,
>
> I think this is what you want.
>
>
> class Kdoi:

Is that a typo?

>    def __init__(self) :
>        self.Fdo()
>

What is all this K and F stuff?

>    def Fdo(self):
>
>      searchterm = 'help'
>      print searchterm     #local
>
>      self.searchterm = searchterm
>      print self.searchterm #used inside the class
>
>      Kdo.searchterm = searchterm   #<<<<
>      print Kdo.searchterm #used outside the class
>      Kdomore()
>
>
>
> class Kdomore(Kdo):
>      def __init__(self) :
>          self.Fdomore()
>
>      def Fdomore(self):
>          searchterm =  Kdo.searchterm   # <<<<
>          print searchterm

It's not apparent what the print statements are for -- are they part of
an attempt to debug your code?

What gives you the idea that this is what the OP wants or needs?




More information about the Python-list mailing list