I want to import a picture by passing a variable which stores its name instead of the name itself. Here is example code
\documentclass{article}
\usepackage[margin=0.7in]{geometry}
\usepackage[parfill]{parskip}
\usepackage[utf8]{inputenc}
\usepackage{xparse}
\usepackage{tikz}
\begin{document}
\ExplSyntaxOn
\newcommand{\varpicture}{
\tl_new:N \l_img_name_tl
\tl_set:Nn \l_img_name_tl {uniquename.png}
\node (p) at (0,0) {
\includegraphics[width=100pt]{uniquename.png} %works
\includegraphics[width=100pt]{\tl_use:N \l_img_name_tl} %doesn't work
};
}
\ExplSyntaxOff
\begin{tikzpicture}
\varpicture
\end{tikzpicture}
\end{document}
Only resource that I found regarding this issue is here: How to use variable for \includegraphics and \attachfile in LaTeX3
If I try to rename the file such that it is called: "uniquename" instead of "uniquename.png" I get the same error, which is that the file cannot be found. None of the solutions used in the other thread work for me.
I compile TeX code with "pdflatex".

\tl_use:Nand use\l_img_name_tldirectly. – Skillmon Dec 30 '20 at 17:02uniquenamereally the name you are trying to use? Side remark: move the\tl_new:Noutside your command. – Ulrike Fischer Dec 30 '20 at 17:05