0

I have two files.

The first file resides in the base directory: main_file.py

The Second File resides in base-directory/helpers/file_with_functions.py

When I try to call the function in the main_file.py using:

from helpers import *

I get "ModuleNotFoundError: No module named 'helpers'"

I've also tried:

from helpers.file_with_functions import *

What am I doing wrong? I'm using the latest version of Python.

James
  • 29,484
  • 4
  • 43
  • 62
mikelowry
  • 961
  • 2
  • 8
  • 23
  • 2
    As an aside, asterisk imports are a bad idea. – AMC Jan 11 '20 at 21:40
  • As @Chris implies, similar questions have been asked regularly - but the TLDR here should be to use the code in your second excerpt but make sure there is an (empty) file called `__init__.py` in your `helpers` directory. – Robin Zigmond Jan 11 '20 at 21:47

0 Answers0