I am trying to import variables from 2WattTues
and 2WattWed
to 2WattThur
but I get this error, what can I do?
Asked
Active
Viewed 258 times
1

abhijat_saxena
- 705
- 5
- 20

Anthony Christou
- 27
- 1
-
JFYI: Using `import * ` isn't a good practice – some_programmer May 17 '20 at 12:41
-
1python scripts mustn't start with a number. – Anwarvic May 17 '20 at 12:41
-
But in case you really have to, check [this question](https://stackoverflow.com/q/9090079/770830) out. – bereal May 17 '20 at 12:44
-
From https://stackoverflow.com/help/minimal-reproducible-example: *DO NOT use images of code. Copy the actual text from your code editor, paste it into the question, then [format it as code](https://stackoverflow.com/editing-help#code). This helps others more easily read and test your code.* – colidyre May 18 '20 at 11:57
-
@Anthony - was I able to answer your question correctly ? – abhijat_saxena May 20 '20 at 18:27
2 Answers
1
Try importing like this
wattTues = __import__('2WattTues')
For performing import * check this out -
How does one do the equivalent of "import * from module" with Python's __import__ function?

abhijat_saxena
- 705
- 5
- 20
0
Names of variables, modules (etc.) cannot start with a digit.

Ozmium42
- 3
- 3
-
1Strictly speaking, *identifiers* cannot start with a digit. It's a syntactic issue, not a limitation of the data model. – chepner May 17 '20 at 13:17