Trigger Threejs and Tweenjs from outside the scope

Hi

i use skypack modules for Threejs and Tween => no problem
But my canva is a part of my html, and i want to use custom function to trigger interaction with it
it’s ok by moving the declration of scene, camera, controlls etc. but i fail to do it with Tween.

My code is not best practices and under dev
You can look it at the source code here : ChronoBackup.com : Visualisation 3D de la TimeLine

Brefiely :

 <script>

        let camera, controls, scene, raycaster, renderer;//,labelRenderer;

        function GO(item){
            const mytarget=scene.getObjectByProperty('ref',item,true)
            const p = mytarget.position;
            let n=p.clone();
            n.x-=70;
            n.y+=25;

            camera.position.x=n.x;
            camera.position.y=n.y;
            camera.position.z=n.z;
            controls.target.x=p.x;
            controls.target.y=p.y;
            controls.target.z=p.z;

            //scene.positionTween = new TWEEN.Tween(camera.position).easing(TWEEN.Easing.Quadratic.InOut);
           // scene.rotationTween = new TWEEN.Tween(controls.target).easing(TWEEN.Easing.Quadratic.InOut);

            //scene.updateCameraTweens(n,p);
        }


    </script>
    <script type="module">

        // Find the latest version by visiting https://cdn.skypack.dev/three.

        import * as THREE from 'https://cdn.skypack.dev/three@0.132.2';
        import * as TWEEN  from 'https://cdn.skypack.dev/@tweenjs/tween.js';

Any suggestion to enable tween transition on my custom js function ?

any javascript file should be a module. if you import something in a.js and then again in b.js, both will access the same namespace, TWEEN and THREE will be the same thing among all modules. as for accessing scene imo you should avoid globals. just use dependency injection:

function go(scene, item) {
  ...

btw why not use a bundler? this would be all so incredibly simple.