Home > Software engineering >  custom module not detected
custom module not detected

Time:06-12

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

CodePudding user response:

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

CodePudding user response:

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 .

  • Related