This is my solution:
(defun my-python-hook-mode ()
(interactive)
(require 'pymacs)
(autoload 'pymacs-apply "pymacs")
(autoload 'pymacs-call "pymacs")
(autoload 'pymacs-eval "pymacs" nil t)
(autoload 'pymacs-exec "pymacs" nil t)
(autoload 'pymacs-load "pymacs" nil t)
(ac-ropemacs-setup)
(setq ropemacs-confirm-saving 'nil)
(ropemacs-mode t)
(define-key python-mode-map "\C-m" 'newline-and-indent)
)
(add-hook 'python-mode-hook 'my-python-hook-mode)
where ac-ropemacs-setup
is defined in the auto-complete module:
(defun ac-ropemacs-require ()
(with-no-warnings
(unless ac-ropemacs-loaded
(pymacs-load "ropemacs" "rope-")
(if (boundp 'ropemacs-enable-autoimport)
(setq ropemacs-enable-autoimport t))
(setq ac-ropemacs-loaded t))))
(defun ac-ropemacs-setup ()
(ac-ropemacs-require)
;(setq ac-sources (append (list 'ac-source-ropemacs) ac-sources))
(setq ac-omni-completion-sources '(("\\." ac-source-ropemacs))))
This solution assume that you use auto-complete at the same time.