I have 2 files:
car.py
class Car:
def __init__(self, model, year, make):
self.model = model
self.year = year
self.make = make
def run(self):
print("Your car is running")
and main.py
from car import Car
my_tesla = Car(model="S-C", year=2023, make="Tesla")
my_tesla.run()
When i run main.py file, it shows ImportError: cannot import name ‘Car’ from ‘car’ (c:UsersAdminDesktopdevcar.py)
Though these 2 files work normally in pycharm. How can i fix this?
I tried to unistall visual studio code and reset my settings, but its just not work
New contributor
Phước Nguyễn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.