I have the following interface in it's own file:

# @version ^0.3.3

interface IFace:
  def read_stuff() -> uint256: view

And I'd like to import it into my other contract.

# @version ^0.3.3
import interfaces.IFace as IFace

def read_contract(some_address: address) -> uint256:
    myContract: IFace = IFace(some_address)
    return myContract.read_stuff()

However, in doing so, I get an error when compiling:

Error compiling: contracts/MyContract.vy
vyper.exceptions.UnknownAttribute: IFace has no member 'read_stuff'. 
  contract "contracts/MyContract.vy", function "read_contract", line 9:11 
       8     myContract: IFace = IFace(some_address)
  ---> 9     return myContract.read_stuff()

What's up?

1 Answer 1


Imported interfaces use a different syntax.

When importing an interface, the syntax you use is like a regular vyper contract. Update your interface as such:

# @version ^0.3.3
def read_stuff() -> uint256: 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.