If I have a module folder structure like this:
studio
tools
__init__.py
camera
__init__.py
camera.py
element
__init__.py
element.py
How do I write the __init__.py files to make it so I can write my import statements like the following? There is a class object in the camera module called CameraNode that I would like to call like shown in the sample below.
from studio import tools
tools.camera.fn()
tools.CameraNode('')
tools.element.fn()
If you have a studio/tools/__init__.py file like this:
from .camera import *
from .element import *
Then you can do a single import elsewhere like:
from studio import tools
and then reference everything as if it were directly in studio.tools.
Not sure if this is answering your question exactly, but hopefully it gets you going in the right direction.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With