I have imported a repo using git and when I try to run a file, it shows that "it could not be resolved". The running script has: import craft_utils import test import file_utils
The imported things are all script. I have attached the screenshots for the error and hierarchy.
How can I solve this? Thanks.
CodePudding user response:
create a empty file named __init__.py
it would solve the issue
CodePudding user response:
Add a file inside of the folder called __init__.py
CodePudding user response:
First you need to create an empty file named __init__.py
in the folder CRAFT-pytorch
Second add these line at the top of the file you're trying to running, before the imports:
import os
import sys
import inspect
app_path = inspect.getfile(inspect.currentframe())
main_dir = os.path.realpath(os.path.dirname(app_path))
sys.path.insert(0, main_dir)
import craft_utils
import test
import file_utils