If the two scripts are on the same page, and if the value to change is global, then it’s possible.
Like:
<script>
var variable = value1
var function1 = function() {
var variable2 =value8
}
</script>
[Some html here]
<script>
variable = value2
</script>
Variable2 is not accessible because it was declared in a function (thus only acessible from that function).
3
solved Changing js variable from different script