jschnieder
jschnieder

Reputation: 211

How to call a group of scripts in a folder with `import`?

In my directory named A, I have 5 .py files that I wrote. I want to do import A (or similar) to access the objects and classes from those 5 .py files, but I am not sure how to make this happen.

How can I do this?

Upvotes: 0

Views: 63

Answers (1)

Pamphile
Pamphile

Reputation: 1906

First, you need to create an (empty) __init__.py file in your directory.

See the module documentation:

The __init__.py files are required to make Python treat directories containing the file as packages.

Upvotes: 1

Related Questions