How do I execute a code from custom code, inside <header>

Hi, I have embedded a js script inside “Custom Code” in the . However, the code is executed only once when the page is loaded or finished loading. How can I trigger an execution of that function again, inside whether, Page Code or backend?