title: Importing any function from an R package into python
body: <p>While using the rpy2 library of Python to work with R. I get the following <strong>error message while trying to import a function of the bnlearn package</strong>:</p>
  
  <pre><code># Using R inside python
  import rpy2
  import rpy2.robjects as robjects
  import rpy2.robjects.packages as rpackages
  from rpy2.robjects.vectors import StrVector
  from rpy2.robjects.packages import importr
  utils = rpackages.importr('utils')
  utils.chooseCRANmirror(ind=1)
  
  # Install packages
  packnames = ('visNetwork', 'bnlearn')
  utils.install_packages(StrVector(packnames))
  
  # Load packages
  visNetwork = importr('visNetwork')
  bnlearn = importr('bnlearn')
  
  tabu = bnlearn.tabu
  fit = bn.learn.bn.fit
  </code></pre>
  
  <p>With the error:</p>
  
  <pre><code>AttributeError: module 'bnlearn' has no attribute 'bn'
  </code></pre>