Skip to main content
deleted 6 characters in body
Source Link
Lior Cohen
  • 5.7k
  • 2
  • 18
  • 33

I am trying to make my own package so that I can use the files in a different folder. This package contains a few different modules and then the main module that imports all the others inside it. For example:

Folder

|- main.py |- other.py |- something.py |- __init__.py 

Inside the main.py I have the imports:

import other.py import something.py 

and it works just fine when running the file itself; however, I added the init__init__.py file and tried to import it into a different folder. The package is recognized, but the main.py gives me the following error:

Exception has occurred: ModuleNotFoundError No module named 'univariate'

File "C:...\stats.py", line 8, in import univariate

File "F:...\testing.py", line 7, in from stats import stats

For clarification, the actual main file is called stats.py. This is my first experience trying to make a package so I might be missing something. Thank you.

I am trying to make my own package so that I can use the files in a different folder. This package contains a few different modules and then the main module that imports all the others inside it. For example:

Folder

|- main.py |- other.py |- something.py |- __init__.py 

Inside the main.py I have the imports:

import other.py import something.py 

and it works just fine when running the file itself; however, I added the init.py file and tried to import it into a different folder. The package is recognized, but the main.py gives me the following error:

Exception has occurred: ModuleNotFoundError No module named 'univariate'

File "C:...\stats.py", line 8, in import univariate

File "F:...\testing.py", line 7, in from stats import stats

For clarification, the actual main file is called stats.py. This is my first experience trying to make a package so I might be missing something. Thank you.

I am trying to make my own package so that I can use the files in a different folder. This package contains a few different modules and then the main module that imports all the others inside it. For example:

Folder

|- main.py |- other.py |- something.py |- __init__.py 

Inside the main.py I have the imports:

import other import something 

and it works just fine when running the file itself; however, I added the __init__.py file and tried to import it into a different folder. The package is recognized, but the main.py gives me the following error:

Exception has occurred: ModuleNotFoundError No module named 'univariate'

File "C:...\stats.py", line 8, in import univariate

File "F:...\testing.py", line 7, in from stats import stats

For clarification, the actual main file is called stats.py. This is my first experience trying to make a package so I might be missing something. Thank you.

Source Link

"ModuleNotFoundError" when importing modules inside package

I am trying to make my own package so that I can use the files in a different folder. This package contains a few different modules and then the main module that imports all the others inside it. For example:

Folder

|- main.py |- other.py |- something.py |- __init__.py 

Inside the main.py I have the imports:

import other.py import something.py 

and it works just fine when running the file itself; however, I added the init.py file and tried to import it into a different folder. The package is recognized, but the main.py gives me the following error:

Exception has occurred: ModuleNotFoundError No module named 'univariate'

File "C:...\stats.py", line 8, in import univariate

File "F:...\testing.py", line 7, in from stats import stats

For clarification, the actual main file is called stats.py. This is my first experience trying to make a package so I might be missing something. Thank you.