Page 1 of 1

[SOLVED]issue with calling functions from a file

Posted: Thu Aug 17, 2017 1:52 pm
by rpi_nerd
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.

Re: issue with calling functions from a file

Posted: Thu Aug 17, 2017 7:36 pm
by Roberthh
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

Posted: Thu Aug 17, 2017 11:50 pm
by rpi_nerd
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.