Problem with javascript in a textfile load

I have some problemes with a custom JS code
My js code is over 1000 charactere. It will be used only in the part of my website. Actually, if i load it in custom code overall part, its work.
The fact is that i only want to load it in some pages, and the code size is 1700 chr so i can’t put it on custom codes in the page setting.
I have put my code in a text field uploaded in media in webflow. datacharts1.txt
My js is the following : <script type="text/javascript" src="" ></script>
The fact is that i have an error message “caught SyntaxError: Cannot use import statement outside a module (”
My original code was loaded in module js with import :

<script type="module">
 import { getGoogleSheetData } from '';
    import { Database, loadAllData } from '';</script>

How can i manage this
If you have any idea :slight_smile:

Here is my site Read-Only: LINK
(how to share your site Read-Only link)

Hi when you import a script you got to appen it wherever you want. Imoort dont works
Here is an exemple on my test site

the script : /

/ create a variable for the script
script = document.createElement(‘script’);
//get the url of the file in txt format on webflow site
script.src = “”;

// you can put it in the head too

The page text to java

the txt file juste console.log “hello I am external”

I think this will save you day. Note as ansered if this is the right solution.

Hmm i’am not sure i have well done.

Try changing type="text/javascript" to type="module".