I have a flask project and I have a templates folder and a root folder that holds my files.
The structure looks like this:
flask_py_Javascript_sandbox/
templates/
form.html
venv/
app.py
formjs.js
My form.html looks like this:
<!DOCTYPE html>
<html>
<body>
// Test form
<script src="../formjs.js"></script> // I have also tried "formjs.js", "/formjs.js"
<script>
myFunc();
</script>
My formjs.js file looks like this:
function myFunc() {
alert("works");
}
I have looked at these 2 questions but they seem to have a slightly different issues. Issues where I don't know if their fix works for my flask project:
How to call external JavaScript function in HTML and Javascript in different folder than HTML
This seems like something simple but all tutorials I've seen just tell you what to type in your files but do not give you the nuances of folder structure.
Any help is appreciated.
Here is a screenshot of my folder structure as my text is causing some confusion:

/), then it doesn't matter in which folder/URLs the the HTML and JS are in. In your case it seems the absolute URL of the JS file seems to be/venv/formjs.js, so usesrc="/venv/formjs.js".venvbut in the root, use/formjs.js.flask runand let it get setup inhttp://127.0.0.1:5000/. Is that going to make a difference?