That post you referenced is a bit dated - I was enthusiastic about finding a way to import librairies, but it definitely isn’t the easiest or most reliable method.
The way I do it today is to include a <script src="_my-script.js">
tag in the card template that initializes the rest of the functionality.