What stops the import of the rule contained in my custom module? I have exported rules from the existing rules and I wanted to import rule using custom module. But when I enable this module. Rules weren't imported in rules list.

I created 3 files: 

1) my_module.INFO file:

name = My module example
description = My module for import rules
core = 7.x
package = My module


2) my_module.MODULE file (blank file):

&lt;?php


3) my_module.rules_defaults.INC file:

&lt;?php
     function rules_example_default_rules_configuration() {
      $configs = array();
      $rule = '{ "rules_final_save_pdfs" : {
        "LABEL" : "final save pdfs",
        "PLUGIN" : "reaction rule",
        "ACTIVE" : false,
        "OWNER" : "rules",
        "REQUIRES" : [ "rules", "views_pdf", "entityform" ],
        "ON" : { "entityform_insert" : [] },
        "IF" : [
          { "entity_has_field" : { "entity" : [ "entityform" ], "field" : "field_test_pdf_form" } }
        ],
        "DO" : [
          { "views_pdf_rules_action_save" : {
              "views_pdf" : "test_new_view:pdf_1",
              "path" : "\/workout\/sites\/default\/files\/test_pdfs\/[entityform:field-date]"
            }
          }
        ]
      }
    }';
      $configs['rules_final_save_pdfs'] = rules_import($rule);
      return $configs;
    }
?&gt;


Please let me know if there any changes to do.
Assuming this is for D7, try this variation of the your code in your item &quot;3)&quot;:
&lt;?php
     function my_module_default_rules_configuration() {
      $configs = array();
      $rule = '{ &quot;rules_final_save_pdfs&quot; : {
        &quot;LABEL&quot; : &quot;final save pdfs&quot;,
        &quot;PLUGIN&quot; : &quot;reaction rule&quot;,
        &quot;ACTIVE&quot; : false,
        &quot;OWNER&quot; : &quot;rules&quot;,
        &quot;REQUIRES&quot; : [ &quot;rules&quot;, &quot;views_pdf&quot;, &quot;entityform&quot; ],
        &quot;ON&quot; : { &quot;entityform_insert&quot; : [] },
        &quot;IF&quot; : [
          { &quot;entity_has_field&quot; : { &quot;entity&quot; : [ &quot;entityform&quot; ], &quot;field&quot; : &quot;field_test_pdf_form&quot; } }
        ],
        &quot;DO&quot; : [
          { &quot;views_pdf_rules_action_save&quot; : {
              &quot;views_pdf&quot; : &quot;test_new_view:pdf_1&quot;,
              &quot;path&quot; : &quot;\/workout\/sites\/default\/files\/test_pdfs\/[entityform:field-date]&quot;
            }
          }
        ]
      }
    }';
      $configs['rules_final_save_pdfs'] = entity_import('rules_config', $rule);
      return $configs;
    }
?&gt;

Note the changes in the line with function ... (near the top) and the line with entity_import (near the end).
Be aware: if I try to import your rule (= the string contained in $rule) in a site of mine (where I don't have views_pdf module enabled), and using the Rules UI, I get an import error like so:

Import failed.
Missing the required module views_pdf.

That makes sense of course (since I don't have that module). So check that that is not the case why your rule isn't imported (same for entityform). A possible technique to prevent this issue, is to declare those 2 modules as a dependency in your my_module.info file.
PS: have a look at the code of the Answers Userpoints module for an example where this technique is used also.