import sys import os sys.path.append(os.getcwd()) # noqa E402 this = sys.modules[__name__] print(this) this.db_name = None print(this.db_name) def initialize_db(name): if (this.db_name is None): this.db_name = name # db_name = "Local Variable" else: msg = f"Database is already initialized to {name}" raise RuntimeError(msg.format(this.db_name))