def generate_mod_command_func(
        self, command: str, command_vars: list[CommandVar]
    ) -> Variable:
        """
        Generates a command attached to a python function that allows special variables.
        """
        new_command = command.replace("?", "{}")
        modified_vars = [command_var_format(item) for item in command_vars]
        final_str = ", ".join(modified_vars)
        func_name = "method_handler{}".format(self.counter)
        replace_func = """.format({})""".format(final_str)
        created_func = ExistingCode.COMMAND_HANDLER_TEMPLATE.value.format(
            func_name, new_command, replace_func
        )

        self.counter += 1

        return Variable(f"self.{func_name}", created_func)

        Generates a command attached to a python function that allows special variables.
        
context_menu/linux_menus.py