def eval(self, code: str) -> tuple[bool, str | None]:
        """Evaluates code in the same context as this function

        Return value is tuple `(success, result)`, success being a boolean and
        result being a string representing the return value of eval, or None if
        exec was used instead.
        """
        try:
            globals_ = vars(sys.modules[self.__module__])
            try:
                return True, str(eval(code, globals_, locals()))
            except SyntaxError:
                exec(code, globals_, locals())
                return True, None
        except Exception:
            error = traceback.format_exc().strip().split("\n")[-1]
            return False, error
Evaluates code in the same context as this function

        Return value is tuple `(success, result)`, success being a boolean and
        result being a string representing the return value of eval, or None if
        exec was used instead.
        
libqtile/command/base.py