V
V
Vlad2020-08-10 11:59:49
Python
Vlad, 2020-08-10 11:59:49

How to import all files from a folder?

There is such a structure:
app.py
modules
1.py
2.py 3.py
There

can be any number of files in modules and they can be called by anyone. How to import all files from the modules folder?

And how to import all files in such a structure? (all app.py should be imported):

app.py
modules
1
app.py
2
app.py
3
app.py

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Tikhonov, 2020-08-10
@vchpro

Well, in general, it is similar to how Django imports migrations: they are generally unidentifiable from python, because the identifier cannot begin with a number. But somehow it works! Conclusion - you need to read the documentation about imports in python.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question