Farhan Ali
Farhan Ali

Reputation: 1

custom module not detected

I'm currently new to python and I'm using micro python. I'm trying to use my custom module however, python can't seem to find it. The file is in the same directory. I've attached 2 images with the code. I don't see why it might not work.

enter image description here

enter image description here

Upvotes: 0

Views: 704

Answers (2)

Marten S.
Marten S.

Reputation: 41

Did you initialise your code as a package (e.g., have an __init__.py file in the same directory)?

If so you might need to locally install it with a setup.py file and the command pip install -e .

Upvotes: 0

Toby Cm
Toby Cm

Reputation: 321

Is controller.py in the same folder as main.py?

If controller.py is in another folder where your main.py is, you need to import it like this:

import the_folder_has_this_file.controller

Upvotes: 1

Related Questions