I use this excellent approach for inserting external Python code in my document. How to highlight Python syntax in LaTeX Listings \lstinputlistings command
\section{TEST}
\pythonexternal[caption=test, label=lst.test.py]{test.py}
But how can I number the listing in my document?
I have tried:
\uespackage{chngcntr}
\counterwithin{lstlisting}{section}
The result: "! Package chngcntr Error: lstlisting is not a counter."