D
D
dontgiveafcuk2018-02-27 23:24:27
Python
dontgiveafcuk, 2018-02-27 23:24:27

How to make changes to a list from another .py file?

There are two files.
the first one stores an empty list
list = []
in the second file, I imported file 1 where the list itself is located
in it, while performing a certain cycle, I write to the list that is in file 1.
something like this
file1.list.append(i)
The problem is the fact that no changes are actually made and the list is still empty, although the ide does not give any errors.
HELP!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
UNy, 2018-02-27
@UNy

Maybe I'm wrong, but don't you get a copy of the imported module instead of the module itself when you import it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question