title: Scrapy: crawl multiple spiders sharing same items, pipeline, and settings but with separate outputs
body: <p>I am trying to run multiple spiders using a Python script based on the code provided in the official documentation. My scrapy project contains <strong>multiple spider (<em>Spider1, Spider2,</em> etc.)</strong> which crawl different websites and save the content of each website in a different JSON file (<em>output1.json, output2.json,</em> etc.). </p>
  
  <p>The items collected on the different websites share the same structure, therefore the spiders use the <strong>same item, pipeline, and setting classes</strong>. The output is generated by a custom JSON class in the pipeline.</p>
  
  <p>When I run the spiders separately they work as expected, but when I use the script below to run the spiders from with scrapy API the items get mixed in the pipeline. <strong><em>Output1.json</em> should only contain items crawled by <em>Spider1</em>, but it also contains the items of <em>Spider2</em></strong>. How can I crawl multiple spiders with scrapy API using same items, pipeline, and settings but generating separate outputs?</p>
  
  <p>Here is the code I used to run multiple spiders:</p>
  
  <pre><code>import scrapy
  from scrapy.crawler import CrawlerProcess
  from web_crawler.spiders.spider1 import Spider1
  from web_crawler.spiders.spider2 import Spider2
  
  settings = get_project_settings()
  process = CrawlerProcess(settings)
  process.crawl(Spider1)
  process.crawl(Spider2)
  process.start()
  </code></pre>
  
  <p>Example output1.json:</p>
  
  <pre><code>{
  "Name": "Thomas"
  "source": "Spider1"
  }
  {
  "Name": "Paul"
  "source": "Spider2"
  }
  {
  "Name": "Nina"
  "source": "Spider1"
  
  }
  </code></pre>
  
  <p>Example output2.json:  </p>
  
  <pre><code>{
  "Name": "Sergio"
  "source": "Spider1"
  }
  {
  "Name": "David"
  "source": "Spider1"
  }
  {
  "Name": "James"
  "source": "Spider2"
  }
  </code></pre>
  
  <p>Normally, all the names crawled by spider1 ("source": "Spider1") should be in output1.json, and all the names crawled by spider2 ("source": "Spider2") should be in output2.json</p>
  
  <p>Thank you for your help!</p>