How to import variable from another file in Python

Python have a simple way to load variables from another file.

First of all put the variables to a file. For eg: variables.py

Then import this file in the program where we need to load the variables.

from variables.py import * 

This will import all objects and methods in the file variables.py to the program.

That's all…

Leave a Reply