How can I import a local python file? it's currently giving an import cannot be resolved pylance error

Viewed 18
from dinocore import Object, grabScreen

dinocore is the name of my other local python file, it's in the same folder. So far I've tried moving the files around into different folders, but that hasn't worked with many different combinations. It says the error is "Import "dinocore" could not be resolved" I've also tried specifying the path like this

from botscript.dinocore import Object, grabScreen

I've also tried tracing back further than that in the import path.

1 Answers

I use the subfolder modules to store my .py files that I use in main.py script in the application root directory and import my modules scripts into main.py using from subfolderName import myScriptName:

'''
AppFolder:    
    main.py   

    modules:
        myTools.py
'''
from modules import myTools as mt
Related