diff --git a/src/chat_control.py b/src/chat_control.py
index 635e808d8a114cc20518cb768db501888204a7a6..e5021bde8fb43219b9e62ea9815a659ab8063151 100644
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -48,7 +48,6 @@ from message_textview import MessageTextView
 from common.contacts import GC_Contact
 from common.logger import Constants
 constants = Constants()
-from common.rst_xhtml_generator import create_xhtml
 from common.pep import MOODS, ACTIVITIES
 from common.xmpp.protocol import NS_XHTML, NS_FILE, NS_MUC, NS_RECEIPTS
 from common.xmpp.protocol import NS_ESESSION
@@ -1872,6 +1871,7 @@ class ChatControl(ChatControlBase):
 				name = gajim.nicks[self.account]
 				if not xhtml and not encrypted and gajim.config.get(
 				'rst_formatting_outgoing_messages'):
+					from common.rst_xhtml_generator import create_xhtml
 					xhtml = create_xhtml(text)
 					if xhtml:
 						xhtml = '<body xmlns="%s">%s</body>' % (NS_XHTML, xhtml)
diff --git a/src/common/connection.py b/src/common/connection.py
index b3d16dca2e71cae99ccea17af5992019cd657b69..598024ae059d5f0995ea469be9e39de32a4d7741 100644
--- a/src/common/connection.py
+++ b/src/common/connection.py
@@ -58,8 +58,6 @@ from common import exceptions
 
 from connection_handlers import *
 
-from common.rst_xhtml_generator import create_xhtml
-
 from string import Template
 import logging
 log = logging.getLogger('gajim.c.connection')
@@ -1078,6 +1076,7 @@ class Connection(ConnectionHandlers):
 		if not self.connection:
 			return 1
 		if msg and not xhtml and gajim.config.get('rst_formatting_outgoing_messages'):
+			from common.rst_xhtml_generator import create_xhtml
 			xhtml = create_xhtml(msg)
 		if not msg and chatstate is None and form_node is None:
 			return 2
@@ -1113,6 +1112,7 @@ class Connection(ConnectionHandlers):
 		if msgtxt and not xhtml and gajim.config.get(
 			'rst_formatting_outgoing_messages'):
 			# Generate a XHTML part using reStructured text markup
+			from common.rst_xhtml_generator import create_xhtml
 			xhtml = create_xhtml(msgtxt)
 		if type_ == 'chat':
 			msg_iq = common.xmpp.Message(to = fjid, body = msgtxt, typ = type_,
@@ -1558,6 +1558,7 @@ class Connection(ConnectionHandlers):
 		if not self.connection:
 			return
 		if not xhtml and gajim.config.get('rst_formatting_outgoing_messages'):
+			from common.rst_xhtml_generator import create_xhtml
 			xhtml = create_xhtml(msg)
 		msg_iq = common.xmpp.Message(jid, msg, typ = 'groupchat', xhtml = xhtml)
 		self.connection.send(msg_iq)