# Refers to a node on a chemfig inside a node in a tikzpicture. Macro definitions

Consider the minimal example:

\documentclass[12pt]{article}

\usepackage{tikz}
\usepackage{chemfig}

\begin{document}

\begin{tikzpicture}

\path node(A){\chemfig{
@{N1}N(-[::90,0.4,,,draw=none]H)-[::-30](<[::-60]CH_2-[::0]OH)-[::60](=[::60]O)-[::-60]-[,0.3,,,draw=none]
@{N2}N(-[::-90,0.4,,,draw=none]H)-[::30](<:[::60]CH_2-[::0]OH)-[::-60](=[::-60]O)-[::60]-[,0.3,,,draw=none]
@{N3}N(-[::90,0.4,,,draw=none]H)-[::-30](<[::-60]CH_2-[::0]OH)-[::60](=[::60]O)-[::-60]-[,0.3,,,draw=none]
}};

\end{tikzpicture}

\begin{tikzpicture}[remember picture,overlay]
\draw[red,very thick](N1)--(N3);
\end{tikzpicture}

\end{document}


Is there a way to put all in one tikzpicture and avoid the need to compile twice? And more important: How can I define variables that allow to do something like this??:

\documentclass[12pt]{article}

\usepackage{tikz}
\usepackage{chemfig}

\def\sera#1{@{N#1}N(-[::90,0.4,,,draw=none]H)-[::-30](<[::-60]CH_2-[::0]OH)-[::60](=[::60]O)-[::-60]}
\def\serb#1{@{N#1}N(-[::-90,0.4,,,draw=none]H)-[::30](<:[::60]CH_2-[::0]OH)-[::-60](=[::-60]O)-[::60]}

\begin{document}

\begin{tikzpicture}

\path node(A){\chemfig{
\sera{1}-[,0.3,,,draw=none]
\serb{2}-[,0.3,,,draw=none]
\sera{3}-[,0.3,,,draw=none]
}};

\end{tikzpicture}

\begin{tikzpicture}[remember picture,overlay]
\draw[red,very thick](N1)--(N3);
\end{tikzpicture}

\end{document}


with let to the error

Package pgf Error: No shape named N1 is known


I figure out that the error come from the expansion of the variables.... but is not in my understanding yet how this work, and I appreciate any help.

Note: I want to handle different chemfig with tikzpicture, therefore the straightforward way with a standalone \chemfig and then a \chemmove is not convenient for my needs.

Thanks

\path node(A){\chemfig{