0

I am trying to import Navigator class in renameFrame.py from navigator.py but, it's giving me an error ModuleNotFoundError: No module named 'navigator' In the below image you can see the directory structure.

enter image description here

Here is an image of the Navigator.py file

enter image description here

Thank you so much for your help 🙏🏻.

2
  • 1
    Please share your code in text format so others can replicate it. Read how-to-ask Commented Nov 18, 2021 at 9:33
  • @Ashutosh Porwal Ok sir Commented Nov 18, 2021 at 9:37

1 Answer 1

1

Python3 dropped support for implicit relative imports. You need to make the import absolute or explicitly relative by adding a leading .:

from .navigator import Navigator

Since you're running rename.py, the Bunch File Rename directory will be in sys.path, but Bunch File Rename/packages is not. Due to this, navigator.py is not on any of the paths where python searches for packages.

Alternatively, you can do:

from packages.navigator import Navigator
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.