8-Bit Borges
8-Bit Borges

Reputation: 10043

Python - Importing modules

given this folder structure:

search/
      __init__.py
      blogs.py
database/
      __init__
      tags.py

if I'm working at tags.py, how can I import a class called crawler inside blogs.py?

Upvotes: 2

Views: 116

Answers (1)

andrew
andrew

Reputation: 5599

You can use the following in tags.py:

import sys
sys.path.append('../')
from search.blogs import crawler

Upvotes: 4

Related Questions