How to import a variable from a module
Article Metadata
The two line code below shows how to import a variable from a module.
Method 1
import mymodule
new_variable=mymodule.x
Method 2
from mymodule import x
or
from mymodule import x as new_variable
The two line code below shows how to import a variable from a module.
import mymodule
new_variable=mymodule.x
from mymodule import x
or
from mymodule import x as new_variable