I have defined a function in external js file. I am not able to use it in home.page.ts file. It is showing TypeError: Cannot read property functionName() of undefined error

index.html

<body>
  <app-root></app-root>
  <script src="assets/multiLayerSource.js"></script>
</body>

multiLayerSource.js

var multiLayerSource;

var layersHT = ;

function SetLayerHT(arglayersHT) {

layersHT = arglayersHT;

}

home.page.ts

import { Component } from ‘@angular/core’;
import { OnInit, Renderer, ViewChild } from ‘@angular/core’;
declare var multiLayerSource: any;
@Component({
selector: ‘app-home’,
templateUrl: ‘home.page.html’,
styleUrls: [‘home.page.scss’],
})
export class HomePage implements OnInit {
layersHTP: any = ;
constructor() {}

ngOnInit() {
this.layersHTP.push( ‘a’, ‘b’, ‘c’, ‘d’ );
multiLayerSource.SetLayerHT(this.layersHTP);
}
}

It is showing error while trying to access SetLayerHT().
The error is :
TypeError: Cannot read property ‘SetLayerHT’ of undefined.

Please help.

Don’t u need to use the keyword export to export the function?