-
Notifications
You must be signed in to change notification settings - Fork 28
No Module Named when Referencing local packages (folders) #92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Learned something else, it seems it works when referencing the folders within functions. |
Adding this to the top of import sys
from pathlib import Path
sys.path.insert(0, Path(__file__).parent.as_posix())
from test import base
... |
Ran into the same issue. Thanks for posting the workaround! |
I'm still seeing the issue even when using the
But @gijswobben's fix, which does work for me, adds this:
|
Just running the main.py locally works.
Referencing a sub folder as a module
tree:
- test
- - __init__.py
- - base.py
- main.py
in main.py:
from test import base
def some_function():
base.testFunc()
if __name__ == "__main__":
some_function()
When deploying the function, or when running emulators locally with
firebase emulators:start
ModuleNotFoundError: No module named 'test'
When running
python main.py
everything works as expectedThe text was updated successfully, but these errors were encountered: