I'm trying to access the boolean macro I defined with my class. Whenever I access the boolean within the class, it works fine. However, if try to access it from the main document (using the same code), I get an Undefined control sequence. \ifMY.
testclass.cls
%! Class = testclass
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{testclass}[2023/11/29 Minimum Working Example Class]
\LoadClass[t,xcolor={x11names},aspectratio=169]{beamer}
\RequirePackage{kvoptions}
\SetupKeyvalOptions{family=MY,prefix=MY@}
\DeclareBoolOption{optA}
\ProcessKeyvalOptions*
\newcommand{\test}{\ifMY@optA
true
\else
false
\fi}
test.tex
% Preamble
\documentclass[optA=false]{testclass}
% Document
\begin{document}
\begin{frame}{Works fine.}
\test
\end{frame}
\begin{frame}{Has an error.}
\ifMY@optA
true
\else
false
\fi
\end{frame}
\end{document}
How can I use the if within the document, or would I have to create a command in the class, similar to \test?

kvoptionssee for example https://tex.stackexchange.com/a/693340/1090 – David Carlisle Dec 03 '23 at 20:20