Hi @Vikasdugi ,
Then that's the reason. The PCFs are not IFrames, so they share the same window. If you inject script tags,both PCFs will write in the same window.
I didn't used that myself. In my opinion it's unsupported to inject script tags in PCFs.
It would be best if you could use another service, where you have a real npm package (I think Azure Maps is one of these).
But if you have to stick with bingmaps, I remember @a33ik did something similar with googlemaps in this pcf: https://pcf.gallery/address-autocomplete/ Maybe he can share from his experience.
If you have it twice on the form, the PCFs will be executed in parallel. With the code you shared above, one of them will unload the code for the other one.
No sure if there is a good way to work around. Maybe it's possible to load the script only once (write in the window that the script tag was started and check that variable). The callback function could send a postMessage. That way all PCFs will be notified when the script was loaded. So the initMap will start when the PCF receive the message.
Hope this helps!