Question: Why module 'openimages' has no attribute 'download'?

Hello,
this topic is just a question about something I want to understand, because I don’t know the reason for it.

So, I installed openimages with pip. When I try to use openimages like that:

import openimages 
openimages.download.download_dataset("example",['castle'])

I’m getting these error message:

AttributeError: module 'openimages' has no attribute 'download'

.
But when I change the lines to:

from openimages.download import download_dataset
download_dataset(dest_dir="example", ['castle'])

then it works.

So can just someone explain, why?
Thanks :slight_smile:

Hello defa,

It has to do with how Python deals with package imports. Have a look at this link.

In brief, I think it’s because the __init__.py file inside the openimages package does not include a command to import the download module.

Hope this helps!
Andrei