Replies: 2 comments 1 reply
-
One thing you can do is to look up modules from Python via |
Beta Was this translation helpful? Give feedback.
-
That's just As for the original question, you could also take nanobind's synthetic submodules and just add them to Recursively auto-generating these assignments when your program first imports |
Beta Was this translation helpful? Give feedback.
-
Pretty much the title. I've seen the nanobind example project, but it's a pretty trivial example. It's not clear to me how I should structure my
__init__.py
files such that relative imports actually work. For example, I have a bunch of nested submodules, such that I can do the following:However, the following does NOT work:
I get the error:
ModuleNotFoundError: No module named 'myexample.m1'
. So, it seems that I need to create my own__init__.py
hierarchy so that these modules can get imported properly. This seems to help with the imports up until nanobind needs to actually find the function, and then it gets very unhappy with my manually specified__all__
. Has anybody gotten imports working properly this way?Edit: I will add that I can get imports sort of working if I use
sys.modules
, but this is a hack and I'd really rather not use it!Beta Was this translation helpful? Give feedback.
All reactions