title: How to make a python class take on a different class?
body: <p>I am making a virtual assistant in Python. I have a class for a prompt, a currently empty class for processing the request, and will have a class for displaying the result.</p>
  
  <p>Here is my code:</p>
  
  <pre class="lang-py prettyprint-override"><code>#Pysistant
  #Google Assistant clone(ish) built with Python and Tkinter
  
  import tkinter as tk
  
  class Prompt:
      def __init__ (self, typ, message):
          self.window = tk.Tk()
          self.message = message
          self.typ = typ.lower()
  
          if typ == "one line":
              self.text = tk.Label(self.window, text=self.message)
              self.frame = tk.Frame(self.window)
              self.entry = tk.Entry(self.frame)
              self.button = tk.Button(self.frame, text="Done", command=lambda: self.command_wrapper(self.entry.get().lower()))
              self.text.pack()
              self.entry.pack()
              self.button.pack()
              self.frame.pack()
  
  
      def command_wrapper(self, query):
          if "math" or "calc" in query:
             func = "math"
             params = query[5:]
          self = Command(func, params)
  
      def quit(self):
         self.window.destroy()
  
  
  class Command:
      def __init__(self, func, params):
          self.window = tk.Tk()
          self.func = func
          self.params = params
          self.text = tk.Label(self.window, text="Processing your request")
          self.text.pack()
          self.quit()
  
      ###TODO: Create subclasses for different functions
  
  
  instance = Prompt('one line', "What would you like to accomplish today?")
  </code></pre>
  
  <p>I expect instance to refer to a <code>Command</code> object after calling <code>command_wrapper()</code>, but it refers to a <code>Prompt</code> object. Calling <code>instance.quit()</code> just destroys the prompt window.</p>