I am trying to pass a variable (MySQL connection class instance) down into a method and then into a class, the issue is that it needs to be done 'by reference' as the main class can change the value. The variable in the final class does not update though:
application:
def __init__(self, quart_instance) -> None:
self._db_object : mysql_connection.MySQLConnection = None
def initialise_app(self):
self.view_blueprint = health_view.create_blueprint(self._db_object)
Health View:
def create_blueprint(db_connector : mysql_connection.MySQLConnection):
view = View(db_connector)
class View:
def __init__(self, db_connector):
self._db_connector = db_connector
When the application performs the database connection in the background in the application I was expecting self._db_connector in the view to update. Any help would be appreciated as I am very confused.