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
  importing variables from module 8376459 1 247 Feb-18-2024, 02:24 PM
Last Post: deanhystad
  no module named 'docx' when importing docx MaartenRo 1 714 Dec-31-2023, 11:21 AM
Last Post: deanhystad
  My code displays too much output when importing class from a module lil_e 4 1,103 Oct-22-2022, 12:56 AM
Last Post: Larz60+
  ERROR: importing desired module mbgamer28 0 1,649 Apr-05-2021, 07:46 PM
Last Post: mbgamer28
  importing matplotlib in jupyter notebook Led_Zeppelin 4 3,401 Feb-25-2021, 07:28 PM
Last Post: snippsat
  importing module - not working jdhamblett 3 2,945 Jun-22-2020, 07:33 PM
Last Post: jdhamblett
  importing same python library in multiple custom module escape_freedom13 6 3,724 May-10-2020, 07:01 PM
Last Post: escape_freedom13
  Importing module from a package results in import error goghvv 2 2,341 Mar-27-2020, 07:13 PM
Last Post: goghvv
  Please help: problem installing/importing langdetect module in Jupyter Notebook ledgreve 3 7,187 Dec-30-2019, 08:17 AM
Last Post: LeanbridgeTech
  Problem with importing and using collections module pythomdummy 3 5,738 Nov-14-2019, 08:48 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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