Python Forum
Importing module in jupyter Noteboook
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Importing module in jupyter Noteboook
#1
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)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  ERROR: importing desired module mbgamer28 0 685 Apr-05-2021, 07:46 PM
Last Post: mbgamer28
  importing matplotlib in jupyter notebook Led_Zeppelin 4 1,455 Feb-25-2021, 07:28 PM
Last Post: snippsat
  importing module - not working jdhamblett 3 1,338 Jun-22-2020, 07:33 PM
Last Post: jdhamblett
  importing same python library in multiple custom module escape_freedom13 6 1,871 May-10-2020, 07:01 PM
Last Post: escape_freedom13
  Importing module from a package results in import error goghvv 2 1,082 Mar-27-2020, 07:13 PM
Last Post: goghvv
  Please help: problem installing/importing langdetect module in Jupyter Notebook ledgreve 3 4,139 Dec-30-2019, 08:17 AM
Last Post: LeanbridgeTech
  Problem with importing and using collections module pythomdummy 3 3,385 Nov-14-2019, 08:48 AM
Last Post: Gribouillis
  Error executing Jupyter command 'notebook': [Errno 'jupyter-notebook' not found] 2 Newtopython123 10 26,106 Apr-25-2019, 07:30 AM
Last Post: banu0395
  Help with importing a module from a package I created. FWendeburg 2 1,384 Mar-12-2019, 04:53 PM
Last Post: FWendeburg
  Importing module error walernor 5 1,816 Feb-02-2019, 04:14 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020