# Tell GUI to update itself by passing self to module?

I hope this is the right spot to ask this, if not tell me and I will delete the post.

I need my GUI/program to update whenever the active_bots variable is changed, to display the contents of this variable.

Is this the correct way to speak to the GUI instance? Pass the instance in the module-call and then set the active_bots-variable by calling the GUI-setter from the module. Or is this bad practice/is there a better way?

Cutting out a lot my code looks like this:

import curses
import modules.bots.quote_bot as quoteBot

class GUI:

def __init__(self, stdscr):

self.active_bots = [] #This variable is the one that needs to be watched

#All kinds of preparation etc.

self.run() # This would normally call run and start the program

def run(self):

while True:
key = self.screen.getch()
if key == ord('e'):
#End program
break
elif (key == ord('q')):
# Start bot
quoteBot.start(self)
else:
#do nothing
continue

#Revert terminal settings and end
self.screen.clear()
curses.endwin()

def active_bots_setter(self, operator, botname):
if (operator == '-'):
self.active_bots.remove(botname)
elif (operator == '+'):
self.active_bots.append(botname)
else:
raise ValueError
self.init_user_window() #Refresh user-window

#Start program.
#Use wrapper to restore original terminal settings even if exception raised
curses.wrapper(GUI)


quote_bot.py

def start(GUI_instance):
#Check whether QuoteBot is already running
logger.info("QuoteBot: Shutting down...")
stop()
else:
logger.info("QuoteBot: Starting up...")
GUI_instance.active_bots_setter('+', "QuoteBot")
if (check_connection() == True):