Cdktf AwsProvider error

I am getting error while using cdktf synth command:

AwsProvider(self, ‘aws’, region=‘us-west-1’ )
NameError: name ‘self’ is not defined


I suspect you are using Python?
Could you share a bit more from your the code you are using that produces this error?


#!/usr/bin/env python
from constructs import Construct
from cdktf import App, TerraformStack
from import AwsProvider

class MyStack(TerraformStack):
def init(self, scope: Construct, ns: str):
super().init(scope, ns)

AwsProvider(self, 'aws', region='us-west-1')

app = App()
MyStack(app, “youtubecdkdemo”)

This is the code I am working

I added provider package and has AwsProvider class in it , However , I am still facing issue. Also in pycharm i can also see this message:

Unresolved reference ‘AwsProvider’
Inspection info: This inspection detects names that should resolve but don’t. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items.

thanks my issue has been fixed.

thanks for the awesome information.