06/22/2021, 8:52 AM
Hi all, struggling with the pulumi automation API in python, and some import issues, wondering if you can help. I'm trying to import a common component resource from a sibling directory as a module. In my files, i'm trying to import:
from ..common.commonComponentResource
And I'm getting relative import errors. From my understanding, the
specified as part of the automation api, needs to be where the stack .yaml files are, and this is then used as the python working directory too. Is there any way to have a different work directory to get around the relative import errors? So the project structure I have is: -- Common ---- ---- -- Stack1 ---- ---- yaml -- Stack2 Thanks for your help!


06/22/2021, 8:56 AM
and this is then used as the python working directory too
I don't think this is necessarily true, it's a little hard to follow your directory layout structure, but your python interpreter just reads the files as they are


06/22/2021, 9:02 AM
Hi, So I've tried printing the python working directory using something like:
Copy code
import os
cwd = os.getcwd()
What I've noticed is when the automation script runs the tries to run the main stack, the working directory is the stack1 folder. Which is why it's having an issue with the relative imports. I should mention, I've using the automation API to run a "Local Program"