Reputation: 889
I have the following structure:
repo_folder
|--> main.py
|-->_init_.py
|--> scripts (folder)
|---> utils.py
I want to import all the classes/functions in utils.py to main.py to do that I tried the following things:
1) from scripts.utils import *
got an error that scripts module wasn't recognized.
2) moved main under scripts and edited the line from .utils import *
I use python 3.6.8 on Ubuntu 18.04 when trying (1) no errors marks shown over the IDE (Pycharm)
Thank you for helping!
Upvotes: 0
Views: 364
Reputation: 382
Try to add "init.py" file to the scripts folder, It's will turn the folder to python package.
and than try
from scripts.utils import *
Upvotes: 1