0

I am working inside of a Django project and I'm trying to import a class from the models.py file. Screen shot of file scaffold shows the google_locator.py file I am trying to import Truck instance from models. I have tried .models, ..models, ../models, ./models, truck.models, and several more combinations.

I either get an "invalid syntax" error or "ImportError: attempted relative import with no known parent package"

  • http@alex-pena May I suggest that you remove the screenshot and replace it with a piece of your code. It can be manipulated more easily than a picture. Pictures are problematic for users on S.O. Maybe the use of code will also help you produce a more careful question? [No images](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question/285557#285557) – mccurcio Jan 20 '21 at 17:58

1 Answers1

0

It looks like you need to add the __init__.py file to the google_api directory. Here's an question that asks what the file is used for in case it's helpful.

schillingt
  • 13,493
  • 2
  • 32
  • 34