1、python3 program, how to  import modules from different directories 
2、How do I get path information of scrapy 

3、from RUGplatform.custom_module.rule_module import CrawlRule, ParserRule
   ImportError: No module named 'RUGplatform'
            Asked
            
        
        
            Active
            
        
            Viewed 34 times
        
    0
            
            
         
    
    
        LWX
        
- 37
- 6
- 
                    duplicate question, please refer below post. [Post](https://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path) – jits_on_moon Jul 12 '18 at 02:57
- 
                    Thank you,but my question may be different,I want to know what the framework does – LWX Jul 12 '18 at 03:24
1 Answers
0
            
            
        my solution:
import os
import sys
sys.path.append('/'.join(os.path.split(os.path.realpath(__file__))[0].split('/')[0:-2]))<br>
from RUGplatform.custom_module.rule_module import CrawlRule, ParserRule
Is there a more elegant solution? For example, the solution from scrapy framework
 
    
    
        LWX
        
- 37
- 6