

Python is only appealing to me (and it's a big appeal) because of the breadth of the libraries available. I've been writing in a threaded language (Forth) professionally for 45 years now. Obviously I've missed some Python fundamentals. Those are still only pulled in at run time.
Thonny import module code#
*: Some python interpreters compile to byte code but unlike statically linked C (and other languages) programs this does not pull in the libraries/modules. Without that all we can do is guess which is likely to waste everyone's time. You should focus on finding (and telling us) why the import fails and with what error(s). It's my experience that importing a custom module/file just works (see ) though I've no idea whether mixing micropython and circuitpython is a good idea or not. If you're running the code in thonny, it must be in the cwd or any of the standard locations for python libraries. If you're running your code in the Pico's REPL the file should be in the root folder of the micropython file system (this is not the file system exposed by the bootsel button). With pico and thonny it can depend on how thonny is configured. If you import foo the interpreter will look for a file called foo.py starting in the cwd. The interpreter must be able to find the required file(s) or the import will fail. Source and object code is the same thing.* Python is an interpreted language not a compiled one. You appear to misunderstanf some python fundamentals. In the options dialog, open the "Intepreter" tab, click "Select executable" and show the location of Anaconda's Python executable.Īfter you have done this, the next time you run your program, it will be run through Anaconda's Python and all the libraries installed there will be available.Surely the source code for a project doesn't have to be on the target! In Thonny, open the "Tools" menu and select "Options.".
Thonny import module full#
For example in Windows the full path is by default c:\anaconda\python.exe.
Thonny import module install#
Install it and find out where it puts the Python executable ( python.exe in Windows and python3 or python in Linux and Mac). Note that Thonny supports only Python 3, so make sure you choose a Python 3 version of Anaconda. Most likely you want the graphical installer and the 64-bit version (you may need a 32-bit version if you have a very old system). Go to and download a suitable binary distribution for your platform. numpy, pandas and matplotlib) have wheels available for popular platforms so you can most likely install them with pip but in case you have trouble, you could try using Thonny with a separate Python distribution meant for scientific computing (eg. Recent versions of most popular scientific Python packages (eg. The Python distribution that comes with Thonny doesn't contain scientific programming libraries (e.g.
