yieniggu
yieniggu

Reputation: 404

Importing two variables from same module python

I’m working on a Jupyter notebook, and am getting an error with this:

First, I import a variable from a module:

from data_generation.names import headers

which gives me no problem at all. Then a few cells below I try to make another import from the same module:

from data_generation.names import alldata_path

which gives me this error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-90-2663c91db1e3> in <module>
      1 from data_generation.data_preprocessing import data_to_csv
----> 2 from data_generation.names import alldata_path

ImportError: cannot import name 'alldata_path'

i got this 2 variables in the file|module names.py, who looks like this:

headers = {"V": ["FECHA", "MEDICION (V)"], "T":["FECHA", "MEDICION (T)"], "A":["FECHA", "MEDICION (A)"]}

alldata_path = ("C:/Users/Bastolo/Desktop/aritech/argomedo-solar-maintenance/data/all_data/")

I would appreciate any help on how to properly do this, since I want to keep a list (not list type) of variables if posible instead of using a dictionary to map all the variables I pretend to use.

EDIT: im getting this error just on the notebook, in IPython works fine... though id like to have it workin on the notebook

Upvotes: 0

Views: 934

Answers (1)

DaLynX
DaLynX

Reputation: 338

Are you looking for this?

from module import a, b, c

Note that if you want to import everything you can just do

from module import *

Or import the module and access them with full path:

import module
module.a()

Upvotes: 1

Related Questions