You'll need to export id from Script1.js but since id is assigned from a fetch call. so, we should export a function to get the value
let id; export function setId(new_id){ id = new_id } export function getId(){ return id }