Import From Module, importing only parts

You can import only parts from a module, by using the from keyword.

Example

The module named mymoduleexample has one function and one dictionary:

def hello(name):
  print("Hello, " + name)

employee1 = {
  "name""Vijay Singh",
  "salary"36000,
  "country""India"
}
 

now Import only the person1 dictionary from the module:

from mymoduleexample import employee1

print (employee1["salary"]) #no need to use the module name when referring to elements in the module