@@ -571,33 +571,54 @@ from pyscript import sync
571571sync .hello (" PyScript" )
572572` ` `
573573
574- ### ` pyscript .py_modules `
574+ ### ` pyscript .py_import `
575575
576576!!! warning
577577
578578 **This is an experimental feature.**
579579
580580 Feedback and bug reports are welcome!
581581
582- If you have a lot of packages referenced in your configuration, startup
582+ If you have a lot of Python packages referenced in your configuration, startup
583583performance may be degraded as these are downloaded.
584584
585- If a package is only needed under certain circumstances, we provide an
585+ If a Python package is only needed under certain circumstances, we provide an
586586asynchronous way to import packages that were not originally referenced in your
587587configuration.
588588
589- ` ` ` html title= " a pyscript.py_modules example"
589+ ` ` ` html title= " A pyscript.py_import example. "
590590< script type= " py" async >
591- from pyscript import py_modules
591+ from pyscript import py_import
592592
593- matplotlib, regex, = await py_modules (" matplotlib" , " regex" )
593+ matplotlib, regex, = await py_import (" matplotlib" , " regex" )
594594
595595print (matplotlib, regex)
596596 </script >
597597```
598598
599- The ` py_modules ` call returns an asynchronous tuple containing the modules
600- referenced as string arguments.
599+ The ` py_import ` call returns an asynchronous tuple containing the Python
600+ modules provided by the packages referenced as string arguments.
601+
602+ ### ` pyscript.js_import `
603+
604+ If you have a lot of JavaScript modules referenced in your configuration,
605+ startup performance may be degraded as these are downloaded.
606+
607+ If a JavaScript module is only needed under certain circumstances, we provide
608+ an asynchronous way to import packages that were not originally referenced in
609+ your configuration.
610+
611+ ``` html title="A pyscript.js_import example."
612+ <script type =" py" async >
613+ from pyscript import js_import, window
614+
615+ escaper, = await js_import (" https://esm.run/html-escaper" )
616+
617+ window .console .log (escaper)
618+ ` ` `
619+
620+ The ` js_import` call returns an asynchronous tuple containing the JavaScript
621+ modules referenced as string arguments.
601622
602623## HTML attributes
603624
0 commit comments