[SOLVED]issue with calling functions from a file

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
rpi_nerd
Posts: 35
Joined: Sat Jul 29, 2017 2:05 pm

[SOLVED]issue with calling functions from a file

Post by rpi_nerd » Thu Aug 17, 2017 1:52 pm

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.
Last edited by rpi_nerd on Thu Aug 17, 2017 11:51 pm, edited 2 times in total.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: issue with calling functions from a file

Post by Roberthh » Thu Aug 17, 2017 7:36 pm

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?

rpi_nerd
Posts: 35
Joined: Sat Jul 29, 2017 2:05 pm

Re: issue with calling functions from a file

Post by rpi_nerd » Thu Aug 17, 2017 11:50 pm

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.

Post Reply