Python Forum

Full Version: Importing module in jupyter Noteboook
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Dear all

I have 2 files one is main.jpynb and keys.jpynb
I have set of keyvalues which i am going to use in main function.

In pyscripter we used to create file main.py and keys. py. We used to define variables and functions in keys.py and it can be easily access in main function.

I have tried this method by declare file name using py . when i opned file it will be in some other format. can someone guide me here
Below code work on pyscripter . I wanted to make it work on jupyter notebook. How can i do it
car.py
class Car:
    def __init__(self, company, model, year):
        self.company = company
        self.model = model
        self.year = year
    def get_details(self):
        details = str(self.year) + ' ' + self.company + ' ' + self.model
        return details
main.py
from car import Car
print(Car)
print('enter the code')
mycar = Car('Ford', 'Escort', 2000)