I've been trying to call a function from a file, having no luck I tried the example from the page:
http://wiki.micropython.org/Importing-Modules
But even with the example this is what I get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'hello'
I'm using my WeMos mini and accessing it via WebREPL. I did try resetting, but same result.
[SOLVED]issue with calling functions from a file
[SOLVED]issue with calling functions from a file
Last edited by rpi_nerd on Thu Aug 17, 2017 11:51 pm, edited 2 times in total.
Re: issue with calling functions from a file
The examples of the link should work Could you share the content and name of the file with the functions hello, which you aim to import?
Re: issue with calling functions from a file
Sorry for the late reply, had an urgent matter to attend to. I took another shot at it a few minutes ago, and now everything works fine; it must have been something stupid on my part (guessing that I didn't tab over correctly for a line of code, or something similar.) I was trying out the first example on that page where you create mod1.py, upload that to the board, and then import and run it.