There is a certain order in which passages are being parsed and ran.
First, everything in the script and widget passages is being processed (and the stylesheet ones too, but those shouldn't contain any active code anyway). This ensures their contents are available before any actual game passage which might use them.
Then comes some special passages like StoryInterface and possibly StoryAuthor, StoryBanner, StorySubtitle and so on. Those define the UI elements and their contents and shouldn't do anything else.
Then, if and only if you start the game anew, comes StoryInit. If you're already mid-game and hit the browser's "reload" button, this passage isn't run and nothing you put in there will be used.
And then your starting passage is run, along with all the task object code and their corresponding special passages.
You want your widgets and macros to be defined as early as possible and you want them to be defined no matter what the player does with the game, so you should put them in the widget and script tagged passages.
That said ... if you need a macro (doesn't work with widget as well from what I saw) in just a single passage, you can also define it right there. Just make sure you do so before you use it.
<<script>>
if(!Macro.has("myMacro")) {
Macro.add("myMacro", { handler() {
new Wikifier(this.output, "Some more code here.");
} });
}
<</script>
<<myMacro>>