python-drafthorse icon indicating copy to clipboard operation
python-drafthorse copied to clipboard

AttributeError: module 'drafthorse' has no attribute 'models'

Open ThomDietrich opened this issue 11 months ago • 1 comments

Hey there, as I want to use your library in a bigger context I'd prefer to call everything with absolute identifiers.

import drafthorse
doc = drafthorse.models.document.Document()

Sadly this throws

AttributeError: module 'drafthorse' has no attribute 'models'

How could I still make this work without hand-picking the imports? Thanks!

ThomDietrich avatar Jan 31 '25 00:01 ThomDietrich

I believe the reason would be that the drafthorse module does not explicitly import its submodules.

However one could still use it like this:

import drafthorse.models.document
doc = drafthorse.models.document.Document()

mfit avatar Feb 04 '25 12:02 mfit