# Lemma numbering not changed in appendix when using a solution

I am trying to implement the lemma numbering solution in this question. I am currently compiling the document from a parent file such that:

\usepackage{chngcntr}
\usepackage{apptools}
\AtAppendix{\counterwithin{lemma}{section}}

\newtheorem{lemma}{Lemma}

\begin{appendices}
\include{Appendix1/appendix1}
\end{appendices}


where the appendix file has

\begin{lemma}
A lemma in appendix.
\end{lemma}


The lemma number remains sequential and doesn't change to reflect that it is in the appendix file...

\begin{appendices}