I tried to set up a Brownie project that looks like this
project
+- scripts
| +- package_one
| | +- __init__.py
| | +- deploy_contract_one.py
| +- package_two
| | +- __init__.py
| | +- deploy_contract_two.py
| +- utils
| +- __init__.py
| +- helper.py
+- contracts
+- ...
where the deploy scripts import helper.py as from utils import helper
. When I run a python script via the python executable, I can pass the -m flag to tell it the script is in a package, but brownie run
doesn't have anything similar.
When I try to run either of my deploy scripts with brownie run package_one.deploy_contract_one
, the error is FileNotFoundError: Cannot find package_one.deploy_contract_one
.
If I try running with brownie run package_one/deploy_contract_one
, then it can find my deploy script, but the error I get is ModuleNotFoundError: No module named 'utils'
.
Everything works if I move the deploy and helper scripts to the root scripts folder and use relative imports.
Is it possible for Brownie to run python scripts in packages, or do I need to restructure this project?