Import only the module browser.ajax ? #2178
-
Hi, I've used so now in my html page I've got this <script type="text/javascript" type="module" async src="brython.js"></script>
<script type="text/javascript" src="brython_ajax.js"></script>
<script type="text/python" src="test.bry"></script> and in the test.bry I got from browser import window, alert, document, ajax but I have still this error in the browser console
any ideas ? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I could not reproduce the issue. Here are the steps I took:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="brython.js"></script>
<script type="text/javascript" src="brython_stdlib.js"></script>
<script type="text/python" src="test.bry"></script>
</head>
<body onload="brython(1)">
</body>
</html>
from browser import window, alert, document, ajax
print('Ajax module', ajax)
Can you try to follow the same sequence and tell me if you still get a ModuleNotFoundError ? |
Beta Was this translation helpful? Give feedback.
-
Glad you could make it work ! Ajax calls are used for user-defined modules / packages, those that are not in the standard distribution. If an application uses both modules from the stdlib and user-defined modules:
|
Beta Was this translation helpful? Give feedback.
I could not reproduce the issue. Here are the steps I took:
brython-cli install
)demo.html
(otherwisebrython_modules.js
has all the stdlib scripts needed bydemo.html
)index.html
bytest.bry
brython-cli start_server 8001
, then loadht…