<@ULVA73B9P> In my Prefect project I have followin...
# ask-marvin
i
@Marvin In my Prefect project I have following structure: /flows/google_flow.py and /integrations/api/google.py how to import class from google.py to google_flow.py if flows and integrations directories are siblings? I get ModuleNotFoundError: No module named 'integrations', despite having init.py everywhere
m
It seems like your issue is related to Python's import system rather than Prefect itself. Given your directory structure, you need to ensure that the parent directory of both
flows
and
integrations
is in your Python path. Here's a concise way to import your class: 1. Ensure the Parent Directory is in the PYTHONPATH: You can do this by setting the
PYTHONPATH
environment variable or by modifying
sys.path
within your script. 2. Import Statement: If the parent directory is correctly set in the path, your import statement in
google_flow.py
should look like this:
Copy code
python
   from integrations.api.google import YourClassName
3. Check
__init__.py
Files
: You've mentioned having
__init__.py
files, which is good. Make sure they are present in both
flows
and
integrations
directories to mark them as packages. If you are running your script from the command line, you can temporarily add the parent directory to the
PYTHONPATH
like this:
Copy code
bash
PYTHONPATH='..' python flows/google_flow.py
This assumes you are in the directory containing both
flows
and
integrations
. If you're still facing issues, please ensure that your working directory is set correctly, and the paths are as expected when running the script.