it doesn’t do the function. it writes an error.
main.py:
import library
library.KAKA(10, 20)
library.py:
class KAKA():
def __init__(self, fruits, vegetables):
self.fruits = fruits
self.vegetables = vegetables
def get_results(self):
print(self.vegetables)
print(self.fruits)
i tried this, but it didn’t work
>Solution :
You should do:
from library import KAKA
and then:
KAKA(10, 20)
This is called an "explicit import".