Get a variable declared outside (before) define blocks in a template, to be valid inside them

In a template, how do you get a variable to be valable declared outside (in top of the file) define blocks, be valable inside them ?
I know I can pass on a context to partials/blocks, but I would rather avoid it. It’s unnatural and adds a lot of complication, compared to the simpler variable (or scratch) syntax.
I just need a “global” variable, valid inside a whole template. Something like the following, if it worked:

{{ $all-class := "" }}
{{ range .Site.Data.drafts.note }}
	{{ $all-class = uniq (slice $all-class .class) }} 
{{ end }}

{{ define "specific-head" }}
<style>
h4, h4+div {
	content-visibility: hidden
}
menu.labels {
	display: flex; flex-wrap: wrap;
	place-content: space-evenly;
}
{{ range $all-class }}
input#{{.}}_input:checked ~ .{{.}},
input#{{.}}_input:checked ~ .{{.}} + h4 {
	content-visibility: visible;
}
{{ end }}
</style>
{{ end }}

{{ define "specific-content"  }}
{{ range $all-class }}
<input type="checkbox" id="{{.}}_input">
{{end}}
{{ with .Site.Data.drafts }}
	{{ range $all-class }}
		<menu class=labels>
		<label for="{{.}}_input">{{.}}</label>
		</menu>
	{{ end }}
  	{{ range .note }}
		<h4 {{with .class}}class="{{delimit . " "}}"{{end}}>{{ .title | .RenderString }}</h4>
	  	<div>{{ .content | .RenderString }}</div>
  	{{ end }}
{{ end }}

{{ end }}

Not possible.

So we have only passing a context. But I’m reusing blocks declared in baseof.html, and we can’t change the context with define blocks. So unless rewriting a complete template from <html> to </html> I don’t know how to do this.

solution: simple, I used scratch declared in another template.