V
V
Valentine2018-08-11 15:52:37
Python
Valentine, 2018-08-11 15:52:37

How to get attribute value from another module?

There is a plants.py file, and it contains the following class:

class Plants:
  def __init__(self):
    self.touched = False
    
  def is_touched(self):
    if not self.touched:
      self.touched = True
      print(self.word)


  def is_untouched(self):
    if  self.touched:
      self.touched = False

How can I get the value of self.touched from another file ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question