'ImportError: No module named <module name> module inside folder

I'm importing files from the following folder inside a python code:

Mask_RCNN
  -mrcnn
    -config.py
    -model.py
    -__init__.py
    -utils.py
    -visualize.py

I'm using the following imports:

These work ok: from Mask_RCNN.mrcnn.config import Config from Mask_RCNN. mrcnn import utils

These give me error:

from Mask_RCNN.mrcnn import visualize
import mrcnn.model as modellib

Error:

ImportError: No module named 'mrcnn'

How to import these properly?



Solution 1:[1]

Use this line before importing the libraries

sys.path.append("Mask_RCNN/") 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Subiksha Baskar