Hi, welcome to the Julia Discourse forum! If you do @which clipboard, it shows that clipboard is defined in the InteractiveUtils module. It appears that this module is automatically loaded by the REPL but not when executing a script. So just adding using InteractiveUtils: clipboard at the start of your script should fix it.
I can’t find anything about this in the documentation, maybe worth investigating and fixing with a PR…