How to do relative import in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to do relative import in python?

Let's suppose this directory. main_project code.py fun.py app model.py data.py I'm working in code.py but I want to import some function data.py which is a present in app directory and I'm unable to import it. How I can import this. i think here relative import work but I don't know how to do this even after doing a google I'm getting error.

23rd Mar 2020, 12:49 PM
Maninder $ingh
Maninder $ingh - avatar
1 Answer