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
  • 32,991
  • 4
  • 47
  • 70
mikelowry
  • 1,307
  • 4
  • 21
  • 43
  • 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