I'm following along with the brownie documentation, and have come across this:
classbrownie.network.contract.Contract(address_or_alias, owner=None) A deployed contract that is not part of a Brownie project.
address_or_alias: Address of the contract. owner: An optional Account instance. If given, transactions to the contract are > sent broadcasted from this account by default.
>>> from brownie import Contract
>>> Contract("0x79447c97b6543F6eFBC91613C655977806CB18b0")
<Token Contract object '0x79447c97b6543F6eFBC91613C655977806CB18b0'>
However, if I take the same code and put it into a script called call.py
I get an error:
brownie run scripts/call.py --network mainnet
Brownie v1.16.4 - Python development framework for Ethereum
MultiCallProject is the active project.
File "brownie/_cli/run.py", line 49, in main
return_value, frame = run(
File "brownie/project/scripts.py", line 53, in run
module = _import_from_path(script)
File "brownie/project/scripts.py", line 149, in _import_from_path
_import_cache[import_str] = importlib.import_module(import_str)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "./scripts/multi-call.py", line 4, in <module>
addr_provider = Contract("0x79447c97b6543F6eFBC91613C655977806CB18b0")
File "brownie/network/contract.py", line 946, in __init__
raise ValueError(f"Unknown contract address: '{address}'")
ValueError: Unknown contract address: '0x79447c97b6543F6eFBC91613C655977806CB18b0'